Comments (3)
Looping in @HindujaB, since this is an issue specific to configurable variables.
Is your expectation to get readonly
and ReadOnlyRecord
as constituent types? The current behaviour may be because ReadOnlyRecord
is already readonly
.
The spec requirements is
The static type of a variable declared as configurable is implicitly readonly: the type specified in the type-descriptor is intersected with readonly.
So IMO, we don't really have to create an intersection type that is readonly & ReadOnlyRecord
for record1
, which is effectively readonly & (readonly & record { string readOnlyValue; })
.
Also note that even if you did get readonly
and ReadOnlyRecord
as constituent types, ReadOnlyRecord
will be an intersection type where one of it's constituent types will be an anonymous record type. The behaviour won't be the same as for NormalRecord
, since with
public type NormalRecord record {
string normalValue;
};
the name NormalRecord
is specified for the record, whereas with
public type ReadOnlyRecord readonly & record {
string readOnlyValue;
};
the name is for the intersection type.
from ballerina-lang.
I agree with the comment from @MaryamZi. We can't depend on the getConstituentTypes()
to return a type-reference type for the first element. It can vary depending on the record descriptor. At runtime, we use a recursive method called getImpliedType()
to extract the underlying record type.
There is a relevant compiler FE API, which we can use.
(Need to move this API to a proper class.)
And, we may need to check the
anonymous
flags to identify the record name.from ballerina-lang.
Agree with the comments. We'll check on a proper implementation for the initial requirement.
from ballerina-lang.
Related Issues (20)
- [Bug]: Annotations in the service type is not visible at the service object at runtime HOT 5
- [Bug]: Dependently-Typed Functions Return Invalid Types when Assigned to an Error HOT 1
- [New Feature]: Provide a user interface to execute Ballerina lifecycle commands
- [New Feature]: Provide a `try-it` code lens for connector actions
- [Improvement]: Improve the code coverage of ballerina lang cli module
- [Bug]: Compiler crash when using `xml:map` with an xml union type HOT 1
- [Bug]: Ballerina program crashes with a CCE when `self` is used as a variable HOT 1
- [Improvement]: Reduce the search space for `listInhabited` with large number of negative atoms
- [Bug]: Worker send hangs when the worker returns early inside if-else blocks HOT 1
- [Bug]: `bal build` showing contradictory behaviours when building with update 9 followed by update 8
- Work on PoC
- [Bug]: `gradle clean` not working on windows
- [Improvement]: Remove unused git submodules
- [Bug]: Incompatible types error when defining services with custom listeners
- [Bug]: Incorrect dependency resolution when generating dependencies programmatically via the project API from Ballerina tools HOT 3
- [Bug]: The order of type definitions influences mapping subtype relation HOT 6
- [Bug]: Referred type is wrong for regxp:RegExp
- [Task]: POC on applying Java virtual threads for Ballerina lock implementation
- [Bug]: Invalid ambiguous type for union of same xml subtype sequence.
- [Task]: Refactor `unescapeJava()` usage in Ballerina Runtime
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ballerina-lang.