implements PR-09.1: remove moduleKey from FE/BE contracts
This commit is contained in:
+1
-4
@@ -6,17 +6,15 @@ import java.util.Objects;
|
||||
|
||||
public record CallableSignatureRef(
|
||||
ModuleId moduleId,
|
||||
String moduleKey,
|
||||
String callableName,
|
||||
int arity,
|
||||
String typeShape) {
|
||||
|
||||
public CallableSignatureRef(
|
||||
final String moduleKey,
|
||||
final String callableName,
|
||||
final int arity,
|
||||
final String typeShape) {
|
||||
this(ModuleId.none(), moduleKey, callableName, arity, typeShape);
|
||||
this(ModuleId.none(), callableName, arity, typeShape);
|
||||
}
|
||||
|
||||
public CallableSignatureRef {
|
||||
@@ -24,7 +22,6 @@ public record CallableSignatureRef(
|
||||
if (!moduleId.isNone()) {
|
||||
moduleId.getIndex();
|
||||
}
|
||||
moduleKey = moduleKey == null ? "" : moduleKey;
|
||||
callableName = Objects.requireNonNull(callableName, "callableName");
|
||||
typeShape = typeShape == null ? "" : typeShape;
|
||||
if (callableName.isBlank()) {
|
||||
|
||||
+2
-4
@@ -10,19 +10,17 @@ public class CallableTable extends InternTable<CallableId, CallableSignatureRef>
|
||||
}
|
||||
|
||||
public CallableId register(
|
||||
final String moduleKey,
|
||||
final String callableName,
|
||||
final int arity,
|
||||
final String typeShape) {
|
||||
return register(new CallableSignatureRef(ModuleId.none(), moduleKey, callableName, arity, typeShape));
|
||||
return register(new CallableSignatureRef(ModuleId.none(), callableName, arity, typeShape));
|
||||
}
|
||||
|
||||
public CallableId register(
|
||||
final ModuleId moduleId,
|
||||
final String moduleKey,
|
||||
final String callableName,
|
||||
final int arity,
|
||||
final String typeShape) {
|
||||
return register(new CallableSignatureRef(moduleId, moduleKey, callableName, arity, typeShape));
|
||||
return register(new CallableSignatureRef(moduleId, callableName, arity, typeShape));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -11,9 +11,9 @@ class CallableTableTest {
|
||||
void shouldInternEqualCallableSignaturesToSameIdentifier() {
|
||||
final var table = new CallableTable();
|
||||
|
||||
final var first = table.register("app/main", "draw", 2, "(simple:int,simple:int)->unit");
|
||||
final var second = table.register("app/main", "draw", 2, "(simple:int,simple:int)->unit");
|
||||
final var third = table.register("app/main", "draw", 1, "(simple:int)->unit");
|
||||
final var first = table.register("draw", 2, "(simple:int,simple:int)->unit");
|
||||
final var second = table.register("draw", 2, "(simple:int,simple:int)->unit");
|
||||
final var third = table.register("draw", 1, "(simple:int)->unit");
|
||||
|
||||
assertEquals(first, second);
|
||||
assertEquals(2, table.size());
|
||||
@@ -22,7 +22,7 @@ class CallableTableTest {
|
||||
|
||||
@Test
|
||||
void shouldRejectInvalidCallableSignatureReferenceContract() {
|
||||
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("app/main", "", 1, "(unit)->unit"));
|
||||
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("app/main", "draw", -1, "(unit)->unit"));
|
||||
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("", 1, "(unit)->unit"));
|
||||
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("draw", -1, "(unit)->unit"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user