-
Notifications
You must be signed in to change notification settings - Fork 743
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 BFields
of generated immutable BRecords
not being marked as SymbolFlags.READONLY
#42521
Fix BFields
of generated immutable BRecords
not being marked as SymbolFlags.READONLY
#42521
Conversation
98020f7
to
a96071c
Compare
a96071c
to
26702f7
Compare
26702f7
to
3e017ec
Compare
...est/java/org/ballerinalang/test/types/readonly/TupleVsArrayReadonlyErrorConsistencyTest.java
Outdated
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
...est/java/org/ballerinalang/test/types/readonly/TupleVsArrayReadonlyErrorConsistencyTest.java
Outdated
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Closed PR due to inactivity for more than 18 days. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #42521 +/- ##
============================================
+ Coverage 77.35% 77.52% +0.17%
- Complexity 58588 58718 +130
============================================
Files 3460 3447 -13
Lines 220086 219720 -366
Branches 28909 28938 +29
============================================
+ Hits 170237 170329 +92
+ Misses 40432 39970 -462
- Partials 9417 9421 +4 ☔ View full report in Codecov by Sentry. |
...erina-unit-test/src/test/java/org/ballerinalang/test/javainterop/basic/StaticMethodTest.java
Outdated
Show resolved
Hide resolved
...est/java/org/ballerinalang/test/types/readonly/TupleVsArrayReadonlyErrorConsistencyTest.java
Outdated
Show resolved
Hide resolved
...est/java/org/ballerinalang/test/types/readonly/TupleVsArrayReadonlyErrorConsistencyTest.java
Outdated
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
…ina-lang into fix-error-code-inconsistency
...t/java/org/ballerinalang/test/expressions/mappingconstructor/MappingConstructorExprTest.java
Show resolved
Hide resolved
...t/java/org/ballerinalang/test/expressions/mappingconstructor/MappingConstructorExprTest.java
Outdated
Show resolved
Hide resolved
expectedExceptionsMessageRegExp = "error: \\{ballerina/lang.map}InherentTypeViolation \\{\"message\":" + | ||
"\"cannot update 'readonly' field 'name' in record of type 'Details & readonly'\".*") | ||
public void testCreateDetails() { | ||
BRunUtil.invoke(result, "testCreateDetails"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the entire record is immutable, the former error is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo, the new message is more meaningful.
And also the new error message is the one we normally get, when we updating a immuatable value
Purpose
Fixes #42520
Approach
After a discussion with @heshanpadmasiri, it was apparent the
InherentTypeViolation
error forBFields
of readonlyBRecords
were not getting triggered. This was due to the mutableBRecord
generation not inheriting the readonly flag to the generatedBFields
.After refactoring the logic to make the
BFields
also inherit the readonly flag, both cases mentioned in #42520 triggered the same error.Samples
Remarks
Check List