Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix class cast expression for use of local variables #46

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed
- [Fix class cast exception when executing query with non-global variable](https://github.com/ballerina-platform/persist-tools/issues/311)

## [1.2.0] - 2023-09-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@

private Query isQueryUsingPersistentClient(FromClauseNode fromClauseNode) {
if (fromClauseNode.expression() instanceof ClientResourceAccessActionNode remoteCall) {
if (remoteCall.expression().kind() != SyntaxKind.SIMPLE_NAME_REFERENCE) {
// This improvement is tracked in
// https://github.com/ballerina-platform/ballerina-standard-library/issues/4943
return null;

Check warning on line 214 in compiler-plugin/src/main/java/io/ballerina/stdlib/persist/sql/compiler/codemodifier/PersistQueryValidator.java

View check run for this annotation

Codecov / codecov/patch

compiler-plugin/src/main/java/io/ballerina/stdlib/persist/sql/compiler/codemodifier/PersistQueryValidator.java#L214

Added line #L214 was not covered by tests
}
SimpleNameReferenceNode clientName = (SimpleNameReferenceNode) remoteCall.expression();
Collection<ChildNodeEntry> clientResourceChildEntries = remoteCall.childEntries();
if (clientResourceChildEntries.size() == 5 || clientResourceChildEntries.size() == 7) {
Expand Down
Loading