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

Revert semtype changes #43742

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .github/workflows/pull_request_full_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ on:
pull_request:
branches:
- master
- java21
- nutcracker
- 2201.[0-9]+.x
- 2201.[0-9]+.[0-9]+-stage

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

jobs:
ubuntu_build:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/pull_request_windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ 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 PersonOP record { string name; int age; }; type EmployeeOP record { string name; int age; int empNo; }; type DepartmentOP record { string code; };"
"code": "type Person record { string name; int age; }; type Employee record { string name; int age; int empNo; }; type Department record { string code; };"
},
{
"description": "Define employee.",
"code": "EmployeeOP employee = {name: \"Jane Doe\", age: 25, empNo: 1};"
"code": "Employee employee = {name: \"Jane Doe\", age: 25, empNo: 1};"
},
{
"description": "Cas employee to person.",
"code": "PersonOP person = <PersonOP>employee;"
"code": "Person person = <Person>employee;"
},
{
"description": "Cas employee to person - get value.",
Expand All @@ -18,7 +18,7 @@
},
{
"description": "Recast back to employee.",
"code": "EmployeeOP employeeTwo = <EmployeeOP>person;"
"code": "Employee employeeTwo = <Employee>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 EmployeeEQ record { string name; int id; }; type PersonEQ record { string name; };"
"code": "type Employee record { string name; int id; }; type Person record { string name; };"
},
{
"description": "Define employee.",
"code": "final EmployeeEQ moduleEmployee = {name: \"John\", id: 2102};"
"code": "final Employee moduleEmployee = {name: \"John\", id: 2102};"
},
{
"description": "Define module ref getter.",
"code": "function getModuleEmployee() returns EmployeeEQ { return moduleEmployee; }"
"code": "function getModuleEmployee() returns Employee { return moduleEmployee; }"
},
{
"description": "Equality ==.",
Expand Down Expand Up @@ -49,7 +49,7 @@
},
{
"description": "Deep inequality in records.",
"code": "EmployeeEQ e1 = {name: \"Jane\", id: 1100}; EmployeeEQ e2 = {name: \"Jane\", id: 1100};"
"code": "Employee e1 = {name: \"Jane\", id: 1100}; Employee e2 = {name: \"Jane\", id: 1100};"
},
{
"description": "Deep inequality in records. - get value",
Expand All @@ -58,7 +58,7 @@
},
{
"description": "Deep equality in records.",
"code": "EmployeeEQ e3 = {name: \"Anne\", id: 1100};"
"code": "Employee e3 = {name: \"Anne\", id: 1100};"
},
{
"description": "Deep equality in records. - get value",
Expand All @@ -67,7 +67,7 @@
},
{
"description": "Reference equality ===.",
"code": "EmployeeEQ e4 = getModuleEmployee(); PersonEQ e5 = getModuleEmployee();"
"code": "Employee e4 = getModuleEmployee(); Person 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 AddressCloneTest record { string country; string state; string city; string street; }; type PersonCloneTest record { string name; int age; boolean married; float salary; AddressCloneTest address; };"
"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; };"
},
{
"description": "Define address.",
"code": "AddressCloneTest address = { country: \"USA\", state: \"NC\", city: \"Raleigh\", street: \"Daniels St\" };"
"code": "Address address = { country: \"USA\", state: \"NC\", city: \"Raleigh\", street: \"Daniels St\" };"
},
{
"description": "Define person.",
"code": "PersonCloneTest person = { name: \"Alex\", age: 24, married: false, salary: 8000.0, address: address };"
"code": "Person person = { name: \"Alex\", age: 24, married: false, salary: 8000.0, address: address };"
},
{
"description": "Clone operation.",
"code": "PersonCloneTest result = person.clone();"
"code": "Person 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 DetailsImmutableTest record {| string name; int id; |};"
"code": "type Details record {| string name; int id; |};"
},
{
"description": "Define Student.",
"code": "type StudentImmutableTest record {| int 'class; DetailsImmutableTest details; map<int> marks; |};"
"code": "type Student record {| int 'class; Details 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": "DetailsImmutableTest & readonly immutableDetails = { name: \"May\", id: 112233 };"
"code": "Details & readonly immutableDetails = { name: \"May\", id: 112233 };"
},
{
"description": "Define immutable Student &",
"code": "StudentImmutableTest & readonly student = { 'class: 12, details: immutableDetails, marks: { math: 80, physics: 85, chemistry: 75 } };"
"code": "Student & readonly student = { 'class: 12, details: immutableDetails, marks: { math: 80, physics: 85, chemistry: 75 } };"
},
{
"description": "Readonly status of student.",
Expand Down
1 change: 0 additions & 1 deletion bvm/ballerina-rt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ 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,8 +90,6 @@ 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,7 +50,6 @@
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 @@ -59,7 +58,6 @@
*/
public final class TypeCreator {

private static final RecordTypeCache registeredRecordTypes = new RecordTypeCache();
/**
* Creates a new array type with given element type.
*
Expand Down Expand Up @@ -149,7 +147,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 @@ -164,16 +162,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 @@ -226,10 +224,6 @@ 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 @@ -246,11 +240,8 @@ 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) {
BRecordType memo = registeredRecordType(typeName, module);
if (memo != null) {
return memo;
}
Type restFieldType,
boolean sealed, int typeFlags) {
return new BRecordType(typeName, module, flags, fields, restFieldType, sealed, typeFlags);
}

Expand Down Expand Up @@ -529,45 +520,4 @@ 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 {

public static final Module EMPTY_MODULE = new Module(null, null, null);
private 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,9 +92,10 @@ 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 BYTE_TAG,
INT_TAG,
case INT_TAG,
SIGNED32_INT_TAG,
SIGNED16_INT_TAG,
SIGNED8_INT_TAG,
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading