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

Sending semtype changes to master #43606

Open
wants to merge 981 commits into
base: 2201.11.0-stage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
981 commits
Select commit Hold shift + click to select a range
fc00fca
Rewrite JvmTypeTestGen, JvmTerminatorGen getMemberTypes calls
lochana-chathura Oct 23, 2024
1a00fe5
Fix wrong interop error msg for error included return types
lochana-chathura Oct 23, 2024
9404493
Implement isAssignableIgnoreObjectTypeIds() properly
lochana-chathura Oct 24, 2024
deddfab
Fix :semtypes:javadoc failure
lochana-chathura Oct 24, 2024
99bcfdf
Simplify equality-expr operand intersection check using semtypes
lochana-chathura Oct 25, 2024
cb06d16
Fix EscapedIdentifiersValidationTest failure due to BType mutation
lochana-chathura Oct 29, 2024
02a9afa
Refactor code to use semtypes
lochana-chathura Oct 29, 2024
7bcd50c
Fix testFunctionalProgramming shell test failure
lochana-chathura Oct 31, 2024
41463dd
Rewrite isTypeCastable() using semtypes
lochana-chathura Nov 6, 2024
9b34bb6
Rewrite intersectionExists() in CodeAnalyzer using semtypes
lochana-chathura Nov 6, 2024
e67221a
Rewrite isNumericConversionPossible(), getErrorTypes() using semtypes
lochana-chathura Nov 6, 2024
001cdd5
Fix :ballerina-langlib:test:test failure
lochana-chathura Nov 7, 2024
244de44
Refactor code based on the review suggestions
lochana-chathura Nov 11, 2024
445ecc9
Simplify JvmTypeTestGen canOptimizeErrorCheck using semtypes
lochana-chathura Nov 11, 2024
e2ce145
Simplify JvmTypeTestGen canOptimizeNilCheck using semtypes
lochana-chathura Nov 11, 2024
eac0942
Rewrite annot type desc validation using semtypes
lochana-chathura Nov 11, 2024
ff06641
Clean up unused methods in SymbolEnter
lochana-chathura Nov 11, 2024
fc1d58c
Merge pull request #43341 from lochana-chathura/semIntegration/cleanup3
lochana-chathura Nov 14, 2024
92fd12d
Merge remote-tracking branch 'upstream/master' into nutcracker-sync
lochana-chathura Nov 18, 2024
c144139
Fix checkStyle failure
lochana-chathura Nov 19, 2024
f205b24
Fix failures on top of java21 changes
lochana-chathura Nov 19, 2024
8e3f67a
Merge pull request #43603 from lochana-chathura/nutcracker-sync
lochana-chathura Nov 19, 2024
a066aca
Refactor simple BTypes
lochana-chathura Nov 7, 2024
5fe3203
Refactor BAnyType
lochana-chathura Nov 12, 2024
ff09bae
Remove obsolete classes and interfaces in types module
lochana-chathura Nov 12, 2024
9079fef
Refactor BReadonlyType
lochana-chathura Nov 13, 2024
4b78b5d
Refactor BTypedescType
lochana-chathura Nov 13, 2024
14bb02b
Refactor BTableType and BFutureType
lochana-chathura Nov 13, 2024
af54e9d
Refactor type env usages
lochana-chathura Nov 14, 2024
0543cd7
Refactor BErrorType type
lochana-chathura Nov 14, 2024
0ed0a1b
Fix checkstyle issues
lochana-chathura Nov 18, 2024
6f99ac2
Make env variable in few BTypes private
lochana-chathura Nov 18, 2024
8cfbb5b
Fix failure due to tSymbols
lochana-chathura Nov 19, 2024
3a6c1b0
Refactor BUnionType type
lochana-chathura Nov 19, 2024
97bd5c4
Refactor BJSONType semtype resolution
lochana-chathura Nov 19, 2024
b38c20b
Refactor BAnydataType semtype resolution
lochana-chathura Nov 19, 2024
7b1c4a2
Implement scaffolding
heshanpadmasiri May 7, 2024
5c6ad82
Port never type
heshanpadmasiri May 9, 2024
f6f8aae
Port nil type
heshanpadmasiri May 10, 2024
fa86d30
Port Decimal type
heshanpadmasiri May 10, 2024
f1c9244
Port float type
heshanpadmasiri May 10, 2024
04592f4
Refactor caches to use DATs
heshanpadmasiri May 10, 2024
24cee8b
Port int type
heshanpadmasiri May 12, 2024
c1cd84f
Port Boolean type
heshanpadmasiri May 12, 2024
056427c
Port String type
heshanpadmasiri May 12, 2024
802f909
Merge pull request #43583 from lochana-chathura/semIntegration/direct…
lochana-chathura Nov 19, 2024
41416cb
Refactor SemType implementation
heshanpadmasiri May 14, 2024
23f02a1
Add doc comments
heshanpadmasiri May 27, 2024
9c204b1
Fix float equality
heshanpadmasiri May 29, 2024
7af9767
Refactor type tests
heshanpadmasiri May 28, 2024
fa2de32
Add runtime type tests provider
heshanpadmasiri May 28, 2024
ca0f47b
Add more basic type tests
heshanpadmasiri May 29, 2024
730ca2f
Fix compile time type bugs
heshanpadmasiri May 29, 2024
a7a5628
Refactor type resolvers
heshanpadmasiri Jun 3, 2024
8763e85
Add runtime type tests provider
heshanpadmasiri May 28, 2024
74ba9d3
Make it possible to create cell type
heshanpadmasiri May 29, 2024
bf0c1ba
Implement bdd operations
heshanpadmasiri May 30, 2024
52999a7
Introduce cell delegate
heshanpadmasiri May 30, 2024
f2d8b70
Implement cell subtype
heshanpadmasiri May 30, 2024
70fbe72
Cache cell type creation
heshanpadmasiri Jun 3, 2024
4452d46
Use read write locks for atom table
heshanpadmasiri Jun 3, 2024
bb2fce5
Add JDoc comments to new classes
heshanpadmasiri Jun 3, 2024
0e78d75
Add minimum implementation to create list types
heshanpadmasiri Jun 4, 2024
11f1e03
Implemented list type projection
heshanpadmasiri Jun 4, 2024
8216b33
Implement list semtype
heshanpadmasiri Jun 5, 2024
6dc5436
Refactor list projection
heshanpadmasiri Jun 6, 2024
f5a6686
Ennable list type tests
heshanpadmasiri Jun 4, 2024
cdd1af7
Make context thread safe
heshanpadmasiri Jun 7, 2024
1556d96
Optimize TypeChecker:basicType
heshanpadmasiri Jun 7, 2024
f3e9361
Port list subtype improvements
heshanpadmasiri Jun 7, 2024
1ad8284
Fix hash and equals for semtypes
heshanpadmasiri Jun 9, 2024
793dd7d
Cache type check results
heshanpadmasiri Jun 10, 2024
6d6cd7a
Reduce the cost of Objects.hash
heshanpadmasiri Jun 10, 2024
1589a9f
Reduce type check cache overhead
heshanpadmasiri Jun 10, 2024
232e271
Implement MappingDefinition
heshanpadmasiri Jun 11, 2024
7a0700f
Implement mapping subtype empty
heshanpadmasiri Jun 11, 2024
44354fd
Enable semtype tests expect projections for mappings
heshanpadmasiri Jun 11, 2024
a9b3ac1
Fix illegal modification of mapping atomic type
heshanpadmasiri Jun 11, 2024
0c738ca
Enable more tests
heshanpadmasiri Jun 11, 2024
9e97681
Implement mapping type projection
heshanpadmasiri Jun 11, 2024
3c7f837
Implement singleton types for BMaps
heshanpadmasiri Jun 12, 2024
a8ba6e6
Fix cyclic recursive type problem
heshanpadmasiri Jun 12, 2024
224139b
Fix never type not being set correctly for records
heshanpadmasiri Jun 13, 2024
e3fe7e7
Make type creation synchronized for definition based types
heshanpadmasiri Jun 16, 2024
f781285
Extend mapping type projection to support getting cell type of field
heshanpadmasiri Jun 16, 2024
d0866bf
Refactor type checker with "widenedType"
heshanpadmasiri Jun 16, 2024
80af2cb
Refactor shape calculation
heshanpadmasiri Jun 16, 2024
4142b2e
Type with shape for mappings
heshanpadmasiri Jun 16, 2024
68f3445
Use shape with lists
heshanpadmasiri Jun 16, 2024
4a9c949
Fix type checker not using shape correctly
heshanpadmasiri Jun 16, 2024
5e8a13c
Fixed optional fields not been handled correctly in shape
heshanpadmasiri Jun 16, 2024
7bf84d2
Fixed readonly values not being handled correctly
heshanpadmasiri Jun 16, 2024
b92edc1
Fix synchronizing bug
heshanpadmasiri Jun 16, 2024
974ca31
Implement caching for shape of map
heshanpadmasiri Jun 16, 2024
08b19f5
Fix expected error message
heshanpadmasiri Jun 17, 2024
c2d39dd
Refactor MappingAtomicType
heshanpadmasiri Jun 20, 2024
3ff74ed
Fix cyclic typing issue
heshanpadmasiri Jun 20, 2024
dd1ba1c
Switch to non sparse array to represent SubTypeData
heshanpadmasiri Jun 22, 2024
367872c
Refact: introduce explicit empty class for TypeCheckCache
heshanpadmasiri Jun 24, 2024
0a9a0db
Implement function semtype
heshanpadmasiri Jul 17, 2024
fce02be
Implement object semtype
heshanpadmasiri Jul 23, 2024
3620471
Fix record shape
heshanpadmasiri Jul 28, 2024
2eb02e7
Implement error semtype
heshanpadmasiri Jul 29, 2024
4c80881
Fix unit tests
heshanpadmasiri Aug 2, 2024
97e4d3d
Add workaround to value converter
heshanpadmasiri Aug 5, 2024
74f2712
Use lazy containers to xml types in Builder
heshanpadmasiri Aug 4, 2024
f64b89f
Use lazy suppliers for PredefinedEnv
heshanpadmasiri Aug 4, 2024
8946917
Rename Lazy containers to lazy suppliers
heshanpadmasiri Aug 4, 2024
d142606
Simplify context supplying
heshanpadmasiri Aug 4, 2024
05f32c3
More lazy initialization in predefined env
heshanpadmasiri Aug 4, 2024
72e1045
Get rid of unwanted private methods and rearrange the code
heshanpadmasiri Aug 4, 2024
4472698
Impmlement handle semtype
heshanpadmasiri Aug 6, 2024
e4b7950
Cleanup BSemTypeWrapper
heshanpadmasiri Aug 6, 2024
a992aa7
Re-ennable type check cache
heshanpadmasiri Aug 6, 2024
1cda781
Encapsulate access to all and some
heshanpadmasiri Aug 6, 2024
cdee3ba
Refactor the semtype class hierachy
heshanpadmasiri Aug 6, 2024
c8e1f0e
Move immutable semtype class to internals
heshanpadmasiri Aug 6, 2024
87eb849
Make BTypes proper semtypes
heshanpadmasiri Aug 7, 2024
92143f9
Patch unit tests with clashing type names
heshanpadmasiri Aug 7, 2024
04c1224
Implement future semtype
heshanpadmasiri Aug 7, 2024
fdff0b9
Implement regex type
heshanpadmasiri Aug 7, 2024
15bc7ac
Implement typedesc semtype
heshanpadmasiri Aug 9, 2024
8449519
Implement table and stream types
heshanpadmasiri Aug 9, 2024
ede9857
Remove fallback type checker from type checking
heshanpadmasiri Aug 13, 2024
df7f942
Implement isSimpleBasicType with SemTypes
heshanpadmasiri Aug 13, 2024
e7e7886
Implement isReferenceEqual with semtypes
heshanpadmasiri Aug 13, 2024
cfeef03
Re ennable type result caching
heshanpadmasiri Aug 13, 2024
5679b6b
Implement value conversion
heshanpadmasiri Aug 13, 2024
40930d6
Remove fallback type checker
heshanpadmasiri Aug 13, 2024
78192d0
Make semtype part of the top type
heshanpadmasiri Aug 13, 2024
bbfbd9a
Refactor isSameType
heshanpadmasiri Aug 13, 2024
b19271d
Optimize convertible type for int subtypes
heshanpadmasiri Aug 14, 2024
b83f54a
Introduce SimpleBdd
heshanpadmasiri Aug 14, 2024
cacca7b
Move MutableSemTypeDependencyManager to internal
heshanpadmasiri Aug 14, 2024
35e1941
Make any and readonly types immutable semtypes
heshanpadmasiri Aug 14, 2024
49fe835
Lazy initialize inner BTypes
heshanpadmasiri Aug 14, 2024
e67c217
Cache cell atom creation
heshanpadmasiri Aug 14, 2024
9a22113
Optimize mapping subtype check
heshanpadmasiri Aug 15, 2024
b9379ad
Use semtypes for valuesEquals
heshanpadmasiri Aug 15, 2024
fed5b55
Use semtypes for casting
heshanpadmasiri Aug 15, 2024
a027250
Refact shapeOf to support inlining
heshanpadmasiri Aug 15, 2024
3a47c04
Refactor memoSubtypeIsEmpty to make it inline
heshanpadmasiri Aug 15, 2024
ada2ffc
Fix thread safty issue in createSemType
heshanpadmasiri Aug 15, 2024
f1dc339
Cache BType results as well
heshanpadmasiri Aug 15, 2024
bb380cd
Only hold weak references in the mutable semtype dependency manager
heshanpadmasiri Aug 15, 2024
7c563ed
Make all context memo tables weak hash maps
heshanpadmasiri Aug 16, 2024
433bb04
Make atom table hold only weak references
heshanpadmasiri Aug 16, 2024
a6e9f47
Cache repeated semtype creation
heshanpadmasiri Aug 16, 2024
9075316
Introduce simplified cell subtype
heshanpadmasiri Aug 18, 2024
039d82e
Avoid caching cell semtypes for complex types
heshanpadmasiri Aug 18, 2024
4557342
Avoid unnecessarily checking for shape
heshanpadmasiri Aug 18, 2024
e97c00e
Cache type check results for user defined types
heshanpadmasiri Aug 18, 2024
5891223
Cache runtime type creation
heshanpadmasiri Aug 18, 2024
6669713
Remove unwanted caching logic
heshanpadmasiri Aug 18, 2024
38b1470
Cleanup access to context
heshanpadmasiri Aug 18, 2024
94f5a74
Refactor anydata type creation
heshanpadmasiri Aug 18, 2024
82e4b34
Use a simple weak map for dependency manager
heshanpadmasiri Aug 19, 2024
a8a4d08
Introduce copy of write BMapType
heshanpadmasiri Aug 19, 2024
10ad23b
Simplify getType
heshanpadmasiri Aug 19, 2024
b06ec83
Remove unwanted optimizations
heshanpadmasiri Aug 19, 2024
61017f9
Fix result caching for futures
heshanpadmasiri Aug 19, 2024
972e724
Fix Union type not getting reset correctly
heshanpadmasiri Aug 19, 2024
a96f7bf
Reduce the overhead for calculating couldShapeBeDifferent
heshanpadmasiri Aug 20, 2024
33da1ac
Be lazy about calculating the flags of tuple types
heshanpadmasiri Aug 20, 2024
fe4382d
Be lazy when creating the semtype result cache
heshanpadmasiri Aug 20, 2024
7e52a7b
Get rid of the stream when filtering nulls
heshanpadmasiri Aug 20, 2024
648ae20
Use concurrent lazy suppliers for BSemTypeWrappers
heshanpadmasiri Aug 21, 2024
097bbb8
Reduce contention in dependency manager
heshanpadmasiri Aug 21, 2024
8747624
Fix runtime semtype resolver
heshanpadmasiri Aug 23, 2024
c7868fa
Fix BFunction Equal
heshanpadmasiri Aug 23, 2024
21d5d6c
Add workarounds to make libraries compile
heshanpadmasiri Aug 23, 2024
c9a5ed4
Better caching of the type creator
heshanpadmasiri Aug 25, 2024
ad1bd59
Make shape calculation thread safe
heshanpadmasiri Aug 25, 2024
a22ba53
Add workaround to handle cyclic shapes
heshanpadmasiri Aug 25, 2024
1859892
Add default implementations to make TestUtils work
heshanpadmasiri Aug 25, 2024
32d4d24
Fix type casts in Intersection type
heshanpadmasiri Aug 25, 2024
dbc26d2
Fix error equals
heshanpadmasiri Aug 25, 2024
f220fbb
Add workaround to make SQL work
heshanpadmasiri Aug 26, 2024
5c542c4
Patch runtime resolver to handle dependtly typed func
heshanpadmasiri Aug 26, 2024
2a98e5a
Fix runtime test errors
heshanpadmasiri Aug 26, 2024
3e8dcdc
Change synchronization of atom table
heshanpadmasiri Aug 28, 2024
3456d8d
Remove BasicTypeBitSet
heshanpadmasiri Aug 31, 2024
19cf208
Restructure semtype structure
heshanpadmasiri Aug 31, 2024
09ede0b
Make tag directly accesible
heshanpadmasiri Sep 1, 2024
7c3aefc
Avoid creating BType when trying to calculate hash and equal for wrapper
heshanpadmasiri Sep 1, 2024
b166f5c
Use result caching with all semtypes
heshanpadmasiri Sep 1, 2024
a058102
Add fast path to hasFillerValue
heshanpadmasiri Sep 2, 2024
03dc027
Refactor workarounds to isSubType
heshanpadmasiri Sep 2, 2024
7da4d8f
Remove MutableSemTypeDependencyManager
heshanpadmasiri Sep 2, 2024
67ac35b
Get rid of BType basic type
heshanpadmasiri Sep 3, 2024
827d22b
Refactor shape anlayzer
heshanpadmasiri Sep 3, 2024
4829592
Avoid creating the inner BType with BSemTypeWrapper when possible
heshanpadmasiri Sep 3, 2024
1752ebc
Fix failing windows errors
heshanpadmasiri Sep 3, 2024
c6efe8d
Fix string shape calculation
heshanpadmasiri Sep 4, 2024
6bea345
Avoid result caching for basic types
heshanpadmasiri Sep 4, 2024
262bfda
Avoid unnecessarily calculating inherent type
heshanpadmasiri Sep 4, 2024
95c4b0f
Avoid unnecessarily creating singleton types
heshanpadmasiri Sep 6, 2024
75e4bcc
Refactor atoms
heshanpadmasiri Sep 8, 2024
db0cc8b
Refactor shape calculation
heshanpadmasiri Sep 6, 2024
3c8b6a6
Get rid of unwanted sychronizations
heshanpadmasiri Sep 8, 2024
c4066b7
Move BddMemo to inner
heshanpadmasiri Sep 11, 2024
093542a
Use accepted type for is likeShape
heshanpadmasiri Sep 15, 2024
58ed6d9
Introduce wrapper for bddEvery
heshanpadmasiri Sep 18, 2024
329c349
Move mutable semtype to inner
heshanpadmasiri Sep 18, 2024
32a95a3
Refactor method names
heshanpadmasiri Sep 29, 2024
8aa8128
Use holder classes to avoid initialization costs in TypeChecker
heshanpadmasiri Sep 29, 2024
aa9fc15
Fix invalid accepted type for union and tables
heshanpadmasiri Oct 1, 2024
d60e067
Refactor type check caching
heshanpadmasiri Oct 3, 2024
c85ccb4
Make cache sharable between type descriptors
heshanpadmasiri Oct 4, 2024
fcede96
Avoid necessary caching in TypeCreator
heshanpadmasiri Oct 4, 2024
54223f5
Avoid duplicate record type creation
heshanpadmasiri Oct 6, 2024
054cd60
Fix narrow type getting cached invalidly
heshanpadmasiri Oct 8, 2024
411e485
Fix tests with duplicate type definitions
heshanpadmasiri Oct 9, 2024
33487c5
Fix comments and naming
heshanpadmasiri Oct 11, 2024
3846215
Fix Dependently typed functions
heshanpadmasiri Oct 13, 2024
04293c3
Fix caching of annon types
heshanpadmasiri Nov 9, 2024
0d36359
Avoid unnecessary locking
heshanpadmasiri Nov 10, 2024
4d22d01
Refactor synchronization logic
heshanpadmasiri Nov 10, 2024
c53f877
Fix future equals
heshanpadmasiri Nov 10, 2024
95367ac
Avoid caching for anon types
heshanpadmasiri Nov 10, 2024
8d1aeca
Use DefinitionContainer to maintain concurrentcy invariants
heshanpadmasiri Nov 11, 2024
016da7e
Fix checkstyle violations
heshanpadmasiri Nov 19, 2024
0ca2edc
Merge pull request #43279 from heshanpadmasiri/feat/runtime-stream
lochana-chathura Nov 20, 2024
7e00058
Update test resources
NipunaRanasinghe Nov 20, 2024
1386283
Add test cases
NipunaRanasinghe Nov 20, 2024
e006755
Fix formatting and checkstyle
NipunaRanasinghe Nov 20, 2024
3a9a0de
Increase the timeout value
gimantha Nov 20, 2024
ec8cf5b
Merge branch 'master' into nutcracker
gimantha Nov 20, 2024
25415e4
Address review suggestions
NipunaRanasinghe Nov 20, 2024
3701963
Bump bir version
lochana-chathura Nov 21, 2024
78fe460
Fix merging issue for LangLibRecordTest class
lochana-chathura Nov 21, 2024
2e71207
Merge pull request #43545 from HindujaB/fix-record-field-master
gimantha Nov 21, 2024
43e6737
Merge pull request #43624 from NipunaRanasinghe/master
NipunaRanasinghe Nov 21, 2024
4330bae
Disable debugger test
HindujaB Nov 21, 2024
58727e7
Merge pull request #43637 from HindujaB/disable-debugger-test
warunalakshitha Nov 21, 2024
58fe102
Merge pull request #43558 from NipunaMadhushan/set-span-status
gimantha Nov 22, 2024
7a51dad
Increase server log reading rate
lochana-chathura Nov 22, 2024
1e2ad86
Fix checkStyle failure
lochana-chathura Nov 22, 2024
b9bd73d
Merge pull request #43594 from ballerina-platform/flow_model
dulajdilshan Nov 22, 2024
4e3496c
Merge branch 'master' of https://github.com/ballerina-platform/baller…
gimantha Nov 22, 2024
e049457
Make process local to method
gimantha Nov 22, 2024
1b89090
Fix import order
gimantha Nov 24, 2024
e79f6e8
Increase server reading rate further
lochana-chathura Nov 24, 2024
4a86052
Increment the wait time
gimantha Nov 25, 2024
5299c50
Merge branch 'nutcracker' of https://github.com/ballerina-platform/ba…
gimantha Nov 25, 2024
2ecf8a2
Increment the wait time
gimantha Nov 25, 2024
d2827d0
Disable integration tests temporarily
gimantha Nov 26, 2024
f765e2f
Revert the sleep time
gimantha Nov 26, 2024
72eb483
Revert using threads
gimantha Nov 27, 2024
45094df
Revert "Revert using threads"
gimantha Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/pull_request_full_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
pull_request:
branches:
- master

- java21
- nutcracker
jobs:
build-lang:
name: Build Ballerina Lang
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pull_request_ubuntu_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
- native-build
- revert-client-decl-master
- query-grouping-aggregation
- java21
- nutcracker

jobs:
ubuntu_build:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull_request_windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
- native-build
- revert-client-decl-master
- query-grouping-aggregation
- java21
- nutcracker

jobs:
windows_build:
name: Build with some tests on Windows
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[
{
"description": "Define types.",
"code": "type Person record { string name; int age; }; type Employee record { string name; int age; int empNo; }; type Department record { string code; };"
"code": "type PersonOP record { string name; int age; }; type EmployeeOP record { string name; int age; int empNo; }; type DepartmentOP record { string code; };"
},
{
"description": "Define employee.",
"code": "Employee employee = {name: \"Jane Doe\", age: 25, empNo: 1};"
"code": "EmployeeOP employee = {name: \"Jane Doe\", age: 25, empNo: 1};"
},
{
"description": "Cas employee to person.",
"code": "Person person = <Person>employee;"
"code": "PersonOP person = <PersonOP>employee;"
},
{
"description": "Cas employee to person - get value.",
Expand All @@ -18,7 +18,7 @@
},
{
"description": "Recast back to employee.",
"code": "Employee employeeTwo = <Employee>person;"
"code": "EmployeeOP employeeTwo = <EmployeeOP>person;"
},
{
"description": "Recast back to employee - get value.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[
{
"description": "Define types.",
"code": "type Employee record { string name; int id; }; type Person record { string name; };"
"code": "type EmployeeEQ record { string name; int id; }; type PersonEQ record { string name; };"
},
{
"description": "Define employee.",
"code": "final Employee moduleEmployee = {name: \"John\", id: 2102};"
"code": "final EmployeeEQ moduleEmployee = {name: \"John\", id: 2102};"
},
{
"description": "Define module ref getter.",
"code": "function getModuleEmployee() returns Employee { return moduleEmployee; }"
"code": "function getModuleEmployee() returns EmployeeEQ { return moduleEmployee; }"
},
{
"description": "Equality ==.",
Expand Down Expand Up @@ -49,7 +49,7 @@
},
{
"description": "Deep inequality in records.",
"code": "Employee e1 = {name: \"Jane\", id: 1100}; Employee e2 = {name: \"Jane\", id: 1100};"
"code": "EmployeeEQ e1 = {name: \"Jane\", id: 1100}; EmployeeEQ e2 = {name: \"Jane\", id: 1100};"
},
{
"description": "Deep inequality in records. - get value",
Expand All @@ -58,7 +58,7 @@
},
{
"description": "Deep equality in records.",
"code": "Employee e3 = {name: \"Anne\", id: 1100};"
"code": "EmployeeEQ e3 = {name: \"Anne\", id: 1100};"
},
{
"description": "Deep equality in records. - get value",
Expand All @@ -67,7 +67,7 @@
},
{
"description": "Reference equality ===.",
"code": "Employee e4 = getModuleEmployee(); Person e5 = getModuleEmployee();"
"code": "EmployeeEQ e4 = getModuleEmployee(); PersonEQ e5 = getModuleEmployee();"
},
{
"description": "Reference equality ===. - get value",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[
{
"description": "Define types.",
"code": "type Address record { string country; string state; string city; string street; }; type Person record { string name; int age; boolean married; float salary; Address address; };"
"code": "type AddressCloneTest record { string country; string state; string city; string street; }; type PersonCloneTest record { string name; int age; boolean married; float salary; AddressCloneTest address; };"
},
{
"description": "Define address.",
"code": "Address address = { country: \"USA\", state: \"NC\", city: \"Raleigh\", street: \"Daniels St\" };"
"code": "AddressCloneTest address = { country: \"USA\", state: \"NC\", city: \"Raleigh\", street: \"Daniels St\" };"
},
{
"description": "Define person.",
"code": "Person person = { name: \"Alex\", age: 24, married: false, salary: 8000.0, address: address };"
"code": "PersonCloneTest person = { name: \"Alex\", age: 24, married: false, salary: 8000.0, address: address };"
},
{
"description": "Clone operation.",
"code": "Person result = person.clone();"
"code": "PersonCloneTest result = person.clone();"
},
{
"description": "Check reference equality.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[
{
"description": "Define Details.",
"code": "type Details record {| string name; int id; |};"
"code": "type DetailsImmutableTest record {| string name; int id; |};"
},
{
"description": "Define Student.",
"code": "type Student record {| int 'class; Details details; map<int> marks; |};"
"code": "type StudentImmutableTest record {| int 'class; DetailsImmutableTest details; map<int> marks; |};"
},
{
"description": "Define addEntryToMap.",
"code": "function addEntryToMap(map<string|int> m, string key, string|int value) { m[key] = value; }"
},
{
"description": "Define immutable Details",
"code": "Details & readonly immutableDetails = { name: \"May\", id: 112233 };"
"code": "DetailsImmutableTest & readonly immutableDetails = { name: \"May\", id: 112233 };"
},
{
"description": "Define immutable Student &",
"code": "Student & readonly student = { 'class: 12, details: immutableDetails, marks: { math: 80, physics: 85, chemistry: 75 } };"
"code": "StudentImmutableTest & readonly student = { 'class: 12, details: immutableDetails, marks: { math: 80, physics: 85, chemistry: 75 } };"
},
{
"description": "Readonly status of student.",
Expand Down
1 change: 1 addition & 0 deletions bvm/ballerina-rt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ dependencies {
dist project(':ballerina-lang:regexp')
dist project(':ballerina-lang:jballerina.java')
dist project(':ballerina-shell:shell-rt')
dist project(':semtypes')

// Third party jars
// config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public final class RuntimeConstants {
// Empty value for string
public static final BString STRING_EMPTY_VALUE = StringUtils.fromString("");

public static final Long INT_MAX_VALUE = 9223372036854775807L;
public static final Long INT_MIN_VALUE = -9223372036854775807L - 1L;
public static final Integer BBYTE_MIN_VALUE = 0;
public static final Integer BBYTE_MAX_VALUE = 255;
public static final Integer SIGNED32_MAX_VALUE = 2147483647;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
* Class @{@link TypeCreator} provides APIs to create ballerina type instances.
Expand All @@ -58,6 +59,7 @@
*/
public final class TypeCreator {

private static final RecordTypeCache registeredRecordTypes = new RecordTypeCache();
/**
* Creates a new array type with given element type.
*
Expand Down Expand Up @@ -147,7 +149,7 @@ public static TupleType createTupleType(List<Type> typeList, Type restType, int
* @return the new tuple type
*/
public static TupleType createTupleType(List<Type> typeList, Type restType,
int typeFlags, boolean isCyclic, boolean readonly) {
int typeFlags, boolean isCyclic, boolean readonly) {
return new BTupleType(typeList, restType, typeFlags, isCyclic, readonly);
}

Expand All @@ -162,16 +164,16 @@ public static TupleType createTupleType(List<Type> typeList, Type restType,
* @return the new tuple type
*/
public static TupleType createTupleType(String name, Module pkg,
int typeFlags, boolean isCyclic, boolean readonly) {
int typeFlags, boolean isCyclic, boolean readonly) {
return new BTupleType(name, pkg, typeFlags, isCyclic, readonly);
}

/**
* Create a {@code MapType} which represents the map type.
*
* @param constraint constraint type which particular map is bound to.
* @return the new map type
*/
* Create a {@code MapType} which represents the map type.
*
* @param constraint constraint type which particular map is bound to.
* @return the new map type
*/
public static MapType createMapType(Type constraint) {
return new BMapType(constraint);
}
Expand Down Expand Up @@ -224,6 +226,10 @@ public static MapType createMapType(String typeName, Type constraint, Module mod
*/
public static RecordType createRecordType(String typeName, Module module, long flags, boolean sealed,
int typeFlags) {
BRecordType memo = registeredRecordType(typeName, module);
if (memo != null) {
return memo;
}
return new BRecordType(typeName, typeName, module, flags, sealed, typeFlags);
}

Expand All @@ -240,8 +246,11 @@ public static RecordType createRecordType(String typeName, Module module, long f
* @return the new record type
*/
public static RecordType createRecordType(String typeName, Module module, long flags, Map<String, Field> fields,
Type restFieldType,
boolean sealed, int typeFlags) {
Type restFieldType, boolean sealed, int typeFlags) {
BRecordType memo = registeredRecordType(typeName, module);
if (memo != null) {
return memo;
}
return new BRecordType(typeName, module, flags, fields, restFieldType, sealed, typeFlags);
}

Expand Down Expand Up @@ -520,4 +529,45 @@ public static FiniteType createFiniteType(String typeName, Set<Object> values, i

private TypeCreator() {
}

private static BRecordType registeredRecordType(String typeName, Module pkg) {
if (typeName == null || pkg == null) {
return null;
}
return registeredRecordTypes.get(new TypeIdentifier(typeName, pkg));
}

public static void registerRecordType(BRecordType recordType) {
String name = recordType.getName();
Module pkg = recordType.getPackage();
if (name == null || pkg == null) {
return;
}
if (name.contains("$anon")) {
return;
}
TypeIdentifier typeIdentifier = new TypeIdentifier(name, pkg);
registeredRecordTypes.put(typeIdentifier, recordType);
}

private static final class RecordTypeCache {

private static final Map<TypeIdentifier, BRecordType> cache = new ConcurrentHashMap<>();

BRecordType get(TypeIdentifier key) {
return cache.get(key);
}

void put(TypeIdentifier identifier, BRecordType value) {
cache.put(identifier, value);
}
}

public record TypeIdentifier(String typeName, Module pkg) {

public TypeIdentifier {
assert typeName != null;
assert pkg != null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
*/
public final class PredefinedTypes {

private static final Module EMPTY_MODULE = new Module(null, null, null);
public static final Module EMPTY_MODULE = new Module(null, null, null);

public static final IntegerType TYPE_INT = new BIntegerType(TypeConstants.INT_TNAME, EMPTY_MODULE);
public static final IntegerType TYPE_INT_SIGNED_8 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ private TypeTags() {
}

public static boolean isIntegerTypeTag(int tag) {

// TODO : Fix byte type. Ideally, byte belongs to here. But we have modeled it differently.
return switch (tag) {
case INT_TAG,
case BYTE_TAG,
INT_TAG,
SIGNED32_INT_TAG,
SIGNED16_INT_TAG,
SIGNED8_INT_TAG,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.ballerina.runtime.api.types.semtype;

/**
* Represent the BDD atom.
*
* @since 2201.11.0
*/
public sealed interface Atom permits RecAtom, TypeAtom {

/**
* Get the index of the atom. For {@code TypeAtoms} this is a unique index within the {@code Env}. Each
* {@code RecAtom} that points to the same {@code TypeAtom} will have the same index.
*
* @return index of the atom
*/
int index();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.ballerina.runtime.api.types.semtype;

import io.ballerina.runtime.internal.types.semtype.CellAtomicType;
import io.ballerina.runtime.internal.types.semtype.FunctionAtomicType;
import io.ballerina.runtime.internal.types.semtype.ListAtomicType;
import io.ballerina.runtime.internal.types.semtype.MappingAtomicType;

/**
* Marker type representing AtomicType.
*
* @since 2201.11.0
*/
public sealed interface AtomicType permits CellAtomicType, FunctionAtomicType, ListAtomicType, MappingAtomicType {

}
Loading
Loading