Skip to content

Commit

Permalink
Add temporary hack to stop sharing allocatedIds across multiple com…
Browse files Browse the repository at this point in the history
…pilations

Resolves ballerina-platform#43348
  • Loading branch information
lochana-chathura committed Sep 3, 2024
1 parent 9b66225 commit 88a123c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ public static Types getInstance(CompilerContext context) {

public Types(CompilerContext context) {
this(context, new Env());
// TODO: this is a temporary workaround.
// For each new Env we need to have a new allocatedIds map.
// Can't move this to Env init as it belongs to a separate module.
BObjectType.resetAllocatedIds();
BErrorType.resetAllocatedIds();
}

public Types(CompilerContext context, Env typeEnv) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ private SemType semTypeInner() {
}
}

public static void resetAllocatedIds() {
DistinctIdSupplier.allocatedIds.clear();
}

private final class DistinctIdSupplier implements Supplier<List<Integer>> {

private List<Integer> ids = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ public boolean isNullable() {
return false;
}

public static void resetAllocatedIds() {
DistinctIdSupplier.allocatedIds.clear();
}

private final class DistinctIdSupplier implements Supplier<List<Integer>> {

private List<Integer> ids = null;
Expand Down

0 comments on commit 88a123c

Please sign in to comment.