feat(studio): improve compiler reliability and AI diagnostics
Preserve structured diagnostics, source attribution, phase outcomes and revision context through compiler, Studio, LSP, MCP and JavaFX. Add project service discovery and resilient VS Code reconnection. Correct all eight reproduced PBS production failures in expression context, sibling executable bindings and nominal owner identity. Consolidate specs, lessons, immutable baseline evidence and the maintained source-to-guest qualification runner. Validation: required Gradle gate recorded 724 tests, with 711 passed and 13 skipped. Full corpus passed 168 compilation observations and 108 guest runs (104 successes and four deliberate faults); supplemental controls passed 42 compilations and 16 guest runs. TypeScript compilation, two Node discovery tests and discussion validation passed.
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
package p.studio.compiler.pbs;
|
||||
|
||||
import p.studio.compiler.pbs.ast.PbsAst;
|
||||
import p.studio.compiler.source.Span;
|
||||
import p.studio.compiler.source.diagnostics.*;
|
||||
import java.util.*;
|
||||
|
||||
/** Records observations from a detector; never resolves another symbol for reporting. */
|
||||
public final class PbsDiagnosticFacts {
|
||||
private PbsDiagnosticFacts() { }
|
||||
public static String symbol(PbsAst.Expression expression) {
|
||||
if (expression instanceof PbsAst.ThisExpr) return "this";
|
||||
if (expression instanceof PbsAst.IdentifierExpr name) return name.name();
|
||||
if (expression instanceof PbsAst.MemberExpr member) return symbol(member.receiver()) + "." + member.memberName();
|
||||
if (expression instanceof PbsAst.CallExpr call) return symbol(call.callee()) + "()";
|
||||
if (expression instanceof PbsAst.GroupExpr group) return symbol(group.expression());
|
||||
return expression.getClass().getSimpleName();
|
||||
}
|
||||
public static DiagnosticSink error(DiagnosticSink sink, String code, String message, Span span,
|
||||
String check, Map<String, Object> facts, FailureKind kind) {
|
||||
var observed = new LinkedHashMap<>(facts);
|
||||
if (span != null && !span.isNone()) observed.putIfAbsent("scopeFileId", span.getFileId().getId());
|
||||
return sink.report(DiagnosticDescriptions.attach(new Diagnostic(Severity.Error, code, message, span, List.of()),
|
||||
check, observed, kind));
|
||||
}
|
||||
}
|
||||
+7
-2
@@ -210,7 +210,7 @@ public final class PbsFrontendCompiler {
|
||||
effectiveNameTable,
|
||||
effectiveFESurfaceContext,
|
||||
diagnosticView,
|
||||
effectiveImportedCallables);
|
||||
effectiveImportedCallables, effectiveImportedGlobals);
|
||||
if (diagnostics.errorCount() > loweringErrorBaseline) {
|
||||
return IRBackendFile.empty(fileId);
|
||||
}
|
||||
@@ -579,12 +579,17 @@ public final class PbsFrontendCompiler {
|
||||
PbsAst.ReturnKind returnKind,
|
||||
PbsAst.TypeRef returnType,
|
||||
String shapeSurface,
|
||||
String targetName) {
|
||||
String targetName, p.studio.compiler.source.Span ownerDeclaration) {
|
||||
public ImportedCallableSurface(ModuleId moduleId, String callableName, int arity, int returnSlots,
|
||||
PbsAst.ReturnKind returnKind, PbsAst.TypeRef returnType, String shapeSurface, String targetName) {
|
||||
this(moduleId, callableName, arity, returnSlots, returnKind, returnType, shapeSurface, targetName, p.studio.compiler.source.Span.none());
|
||||
}
|
||||
public ImportedCallableSurface(ModuleId moduleId, String callableName, int arity, int returnSlots,
|
||||
PbsAst.ReturnKind returnKind, PbsAst.TypeRef returnType, String shapeSurface) {
|
||||
this(moduleId, callableName, arity, returnSlots, returnKind, returnType, shapeSurface, callableName);
|
||||
}
|
||||
public ImportedCallableSurface {
|
||||
ownerDeclaration = ownerDeclaration == null ? p.studio.compiler.source.Span.none() : ownerDeclaration;
|
||||
moduleId = moduleId == null ? ModuleId.none() : moduleId;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@ public final class PbsGenericDiagnostics extends DiagnosticSink {
|
||||
related.add(new RelatedSpan("Application requested here", origin.requestedAt()));
|
||||
}
|
||||
delegate.report(new Diagnostic(diagnostic.getSeverity(), diagnostic.getCode(), diagnostic.getPhase(),
|
||||
diagnostic.getTemplateId(), diagnostic.getPlaceholders(), message, diagnostic.getSpan(), related));
|
||||
diagnostic.getTemplateId(), diagnostic.getPlaceholders(), message, diagnostic.getSpan(), related,
|
||||
diagnostic.getContext(), diagnostic.getReportedPhase()));
|
||||
return this;
|
||||
}
|
||||
@Override public Collection<Diagnostic> asCollection() { return delegate.asCollection(); }
|
||||
|
||||
+18
@@ -20,6 +20,24 @@ import static p.studio.compiler.pbs.PbsReservedMetadataExtractor.typeSurfaceKey;
|
||||
|
||||
public final class PbsModuleVisibilityValidator {
|
||||
|
||||
/** Declaration/signature-level sibling admission, using the same keys as barrel validation. */
|
||||
public Set<Span> siblingDeclarations(ModuleUnit module, NameTable names) {
|
||||
var interning = new SignatureInterning(new TypeSurfaceTable(), new CallableShapeTable());
|
||||
var declarations = collectDeclarations(module, names, interning);
|
||||
var admitted = new HashSet<Span>();
|
||||
for (var barrel : module.barrelFiles()) for (var item : barrel.ast().items()) {
|
||||
if (item instanceof PbsAst.BarrelFunctionItem f) {
|
||||
var key = functionKey(f.name(), f.typeParameters().size(), f.parameterTypes().asList(),
|
||||
f.returnKind(), f.returnType(), f.resultErrorType(), names, interning);
|
||||
admitted.addAll(declarations.functionsBySignature.getOrDefault(key, List.of()));
|
||||
} else {
|
||||
var key = new NonFunctionSymbolKey(nonFunctionKind(item), names.register(nonFunctionName(item)));
|
||||
admitted.addAll(declarations.nonFunctionsByKindAndName.getOrDefault(key, List.of()));
|
||||
}
|
||||
}
|
||||
return Set.copyOf(admitted);
|
||||
}
|
||||
|
||||
public void validate(
|
||||
final ReadOnlyList<ModuleUnit> modules,
|
||||
final DiagnosticSink diagnostics) {
|
||||
|
||||
+72
-25
@@ -98,13 +98,12 @@ final class PbsExecutableBodyLowerer {
|
||||
try {
|
||||
maxStackSlots = stackAnalyzer.analyzeMaxStackSlots(ReadOnlyList.wrap(context.instructions()), returnSlots);
|
||||
} catch (PbsExecutableStackAnalyzer.ExecutableLoweringAnalysisException e) {
|
||||
diagnostics.error(
|
||||
DiagnosticPhase.STATIC_SEMANTICS,
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(),
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(),
|
||||
Map.of(),
|
||||
e.getMessage(),
|
||||
functionDecl.span());
|
||||
p.studio.compiler.pbs.PbsDiagnosticFacts.error(diagnostics,
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(), e.getMessage(), functionDecl.span(),
|
||||
"pbs.lowering.stack-shape", p.studio.utilities.json.ImmutableJson.fields("construction", "function",
|
||||
"symbol", functionDecl.name(), "declaredTypes", context.types().canonical(functionDecl.returnType()),
|
||||
"declaredResultSlots", returnSlots, "instructionCount", context.instructions().size(),
|
||||
"condition", e.getMessage()), p.studio.compiler.source.diagnostics.FailureKind.INTERNAL_FAILURE);
|
||||
return null;
|
||||
}
|
||||
final var localSlots = Math.max(0, context.nextLocalSlot() - functionDecl.parameters().stream().mapToInt(p -> context.types().slots(p.typeRef())).sum());
|
||||
@@ -441,8 +440,20 @@ final class PbsExecutableBodyLowerer {
|
||||
case PbsAst.CallExpr callExpr -> lowerCallExpression(callExpr, context);
|
||||
case PbsAst.ApplyExpr applyExpr -> lowerApply(applyExpr, context);
|
||||
case PbsAst.BinaryExpr binaryExpr -> {
|
||||
lowerExpression(binaryExpr.left(), context);
|
||||
lowerExpression(binaryExpr.right(), context);
|
||||
// Comparison result context belongs to the comparison, not its operands.
|
||||
boolean comparison = java.util.Set.of("==", "!=", "<", "<=", ">", ">=").contains(binaryExpr.operator());
|
||||
if (comparison) {
|
||||
var previous = context.expectedType;
|
||||
PbsAst.TypeRef leftType, rightType;
|
||||
context.expectedType = null;
|
||||
try { leftType = expressionType(binaryExpr.left(), context); rightType = expressionType(binaryExpr.right(), context); }
|
||||
finally { context.expectedType = previous; }
|
||||
lowerExpected(binaryExpr.left(), leftType != null ? leftType : rightType, context);
|
||||
lowerExpected(binaryExpr.right(), rightType != null ? rightType : leftType, context);
|
||||
} else {
|
||||
lowerExpression(binaryExpr.left(), context);
|
||||
lowerExpression(binaryExpr.right(), context);
|
||||
}
|
||||
emitBinaryOperatorInstruction(binaryExpr.operator(), binaryExpr.span(), context);
|
||||
}
|
||||
case PbsAst.UnaryExpr unaryExpr -> {
|
||||
@@ -570,6 +581,7 @@ final class PbsExecutableBodyLowerer {
|
||||
return;
|
||||
}
|
||||
if (lowerStructuredCall(callExpr, context)) return;
|
||||
final var failedStructuredCallFacts = context.lastCallFacts;
|
||||
if (callExpr.callee() instanceof PbsAst.MemberExpr member) {
|
||||
var receiverType = PbsRuntimeTypes.unwrap(expressionType(member.receiver(), context));
|
||||
if (receiverType != null && receiverType.kind() == PbsAst.TypeRefKind.OPTIONAL
|
||||
@@ -593,6 +605,7 @@ final class PbsExecutableBodyLowerer {
|
||||
}
|
||||
lowerCallsiteReceiver(callExpr.callee(), context);
|
||||
lowerCallArguments(callExpr, context);
|
||||
context.lastCallFacts = failedStructuredCallFacts;
|
||||
callsiteEmitter.emitCallsite(callExpr, context);
|
||||
}
|
||||
|
||||
@@ -644,7 +657,7 @@ final class PbsExecutableBodyLowerer {
|
||||
final PbsAst.MemberExpr memberExpr,
|
||||
final PbsExecutableLoweringContext context) {
|
||||
var receiverType = PbsRuntimeTypes.unwrap(expressionType(memberExpr.receiver(), context));
|
||||
var service = receiverType == null ? null : context.types().services.get(receiverType.name());
|
||||
var service = receiverType == null ? null : context.types().service(receiverType);
|
||||
if (service != null) {
|
||||
var key = service.name() + "." + memberExpr.memberName();
|
||||
if (context.types().constants.containsKey(key)) {
|
||||
@@ -687,7 +700,7 @@ final class PbsExecutableBodyLowerer {
|
||||
}
|
||||
reportUnsupportedLowering("Unknown native field",memberExpr.span(),context);return;
|
||||
}
|
||||
var struct = receiverType == null ? null : context.types().structs.get(receiverType.name());
|
||||
var struct = receiverType == null ? null : context.types().struct(receiverType);
|
||||
if (struct != null) {
|
||||
for (int i=0;i<struct.fields().size();i++) if (struct.fields().get(i).name().equals(memberExpr.memberName())) {
|
||||
lowerExpected(memberExpr.receiver(), receiverType, context);
|
||||
@@ -1112,7 +1125,7 @@ final class PbsExecutableBodyLowerer {
|
||||
}
|
||||
if (call.callee() instanceof PbsAst.MemberExpr member) {
|
||||
var owner=PbsRuntimeTypes.unwrap(expressionType(member.receiver(),c));
|
||||
var service=owner==null?null:c.types().services.get(owner.name());
|
||||
var service=owner==null?null:c.types().service(owner);
|
||||
if (service!=null) {
|
||||
var methods=service.methods().stream().filter(m -> m.name().equals(member.memberName())
|
||||
&& m.parameters().size()==signature.parameters().size()
|
||||
@@ -1129,7 +1142,7 @@ final class PbsExecutableBodyLowerer {
|
||||
private boolean lowerNamedStructApply(PbsAst.ApplyExpr apply,PbsAst.TupleExpr tuple,PbsExecutableLoweringContext c) {
|
||||
if(!(apply.callee() instanceof PbsAst.MemberExpr member))return false;
|
||||
var owner=PbsRuntimeTypes.unwrap(expressionType(member.receiver(),c));
|
||||
var declaration=owner==null?null:c.types().structs.get(owner.name());
|
||||
var declaration=owner==null?null:c.types().struct(owner);
|
||||
if(declaration==null)return false;
|
||||
var methods=declaration.methods().stream().filter(m->m.name().equals(member.memberName())&&m.parameters().size()==tuple.items().size()).toList();
|
||||
if(methods.size()!=1)return false;
|
||||
@@ -1188,14 +1201,14 @@ final class PbsExecutableBodyLowerer {
|
||||
if (e instanceof PbsAst.IndexExpr index) {
|
||||
var array = PbsRuntimeTypes.unwrap(expressionType(index.receiver(), c));
|
||||
if(array==null)return null;
|
||||
var declaration=c.types().structs.get(array.name());
|
||||
var declaration=c.types().struct(array);
|
||||
return p.studio.compiler.pbs.PbsSdkCollections.hasIndexer(declaration)
|
||||
? declaration.methods().stream().filter(m->m.name().equals("_at")).findFirst().orElseThrow().returnType()
|
||||
: PbsAst.TypeRef.optional(array.inner(),index.span());
|
||||
}
|
||||
if (e instanceof PbsAst.MemberExpr member) {
|
||||
var serviceType = expressionType(member.receiver(), c);
|
||||
var service = serviceType == null ? null : c.types().services.get(serviceType.name());
|
||||
var service = serviceType == null ? null : c.types().service(serviceType);
|
||||
if (service != null) {
|
||||
var constant = c.types().constants.get(service.name() + "." + member.memberName());
|
||||
if (constant != null) return constant.explicitType();
|
||||
@@ -1204,7 +1217,7 @@ final class PbsExecutableBodyLowerer {
|
||||
if (receiver != null && receiver.kind() == PbsAst.TypeRefKind.ARRAY && member.memberName().equals("length")) return PbsRuntimeTypes.type("long");
|
||||
if (receiver != null && receiver.kind() == PbsAst.TypeRefKind.NAMED_TUPLE)
|
||||
for (var field : receiver.fields()) if (field.label().equals(member.memberName())) return field.typeRef();
|
||||
var struct = receiver == null ? null : c.types().structs.get(receiver.name());
|
||||
var struct = receiver == null ? null : c.types().struct(receiver);
|
||||
if (struct != null) for (var field : struct.fields()) if (field.name().equals(member.memberName())) return field.typeRef();
|
||||
var builtinFields=receiver==null?null:c.types().fields.get(receiver.name());
|
||||
if(builtinFields!=null)for(var field:builtinFields)if(field.name().equals(member.memberName()))return field.typeRef();
|
||||
@@ -1232,7 +1245,7 @@ final class PbsExecutableBodyLowerer {
|
||||
if (e instanceof PbsAst.IfExpr branch) return expressionType(branch.thenBlock().tailExpression(), c);
|
||||
if (e instanceof PbsAst.SwitchExpr branch && !branch.arms().isEmpty()) return expressionType(branch.arms().getFirst().block().tailExpression(), c);
|
||||
if (e instanceof PbsAst.ApplyExpr apply) return expressionType(applyCall(apply), c);
|
||||
if (e instanceof PbsAst.NewExpr value) return value.typeName().equals("array") ? (value.explicitType() != null ? value.explicitType() : c.expectedType) : PbsRuntimeTypes.type(value.typeName());
|
||||
if (e instanceof PbsAst.NewExpr value) return value.typeName().equals("array") ? (value.explicitType() != null ? value.explicitType() : c.expectedType) : c.types().sourceType(value.typeName());
|
||||
if (e instanceof PbsAst.CallExpr call) {
|
||||
var fn = isDirectFunction(call.callee(), c) ? null : PbsRuntimeTypes.unwrap(expressionType(call.callee(),c));
|
||||
if (fn != null && fn.kind() == PbsAst.TypeRefKind.FN) return fn.inner();
|
||||
@@ -1254,8 +1267,8 @@ final class PbsExecutableBodyLowerer {
|
||||
if (candidates.size() == 1) return candidates.getFirst().returnType();
|
||||
for (var method : candidates) if (returnMatches(method.returnType(),owner.name(),c)) return method.returnType();
|
||||
}
|
||||
var struct = c.types().structs.get(owner.name());
|
||||
var service = c.types().services.get(owner.name());
|
||||
var struct = c.types().struct(owner);
|
||||
var service = c.types().service(owner);
|
||||
var methods = struct != null ? struct.methods() : service != null ? service.methods() : ReadOnlyList.<PbsAst.FunctionDecl>empty();
|
||||
var applicable=methods.stream().filter(candidate -> candidate.name().equals(member.memberName())
|
||||
&& parametersMatch(candidate.parameters(),call.arguments(),c)).toList();
|
||||
@@ -1734,7 +1747,7 @@ final class PbsExecutableBodyLowerer {
|
||||
}
|
||||
|
||||
private boolean lowerCollectionIndex(PbsAst.IndexExpr index, PbsAst.Expression value, PbsAst.TypeRef type, PbsExecutableLoweringContext c) {
|
||||
var declaration=type==null?null:c.types().structs.get(type.name());
|
||||
var declaration=type==null?null:c.types().struct(type);
|
||||
if(!p.studio.compiler.pbs.PbsSdkCollections.hasIndexer(declaration))return false;
|
||||
var name=value==null?"_at":"_put";
|
||||
var method=declaration.methods().stream().filter(m->m.name().equals(name)).findFirst().orElseThrow();
|
||||
@@ -2014,7 +2027,7 @@ final class PbsExecutableBodyLowerer {
|
||||
return hasElseBranch(stmt)&&yes&&no;
|
||||
}
|
||||
private void lowerStructNew(PbsAst.NewExpr expr,PbsExecutableLoweringContext c) {
|
||||
var declaration=c.types().structs.get(expr.typeName());
|
||||
var declaration=c.types().struct(c.types().sourceType(expr.typeName()));
|
||||
if (p.studio.compiler.pbs.PbsStdlibConstruction.factoryOnly(declaration) && !c.types().allowedFactoryOrigins.contains(declaration.span())) {
|
||||
reportUnsupportedLowering("Stdlib construction requires its canonical declaring module", expr.span(), c); return;
|
||||
}
|
||||
@@ -2072,7 +2085,7 @@ final class PbsExecutableBodyLowerer {
|
||||
var target=statement.target();
|
||||
PbsAst.Expression receiver=target.rootName().equals("this")?new PbsAst.ThisExpr(target.span()):new PbsAst.IdentifierExpr(target.rootName(),target.span());
|
||||
for(int i=0;i<target.pathSegments().size()-1;i++)receiver=new PbsAst.MemberExpr(receiver,target.pathSegments().get(i),target.span());
|
||||
var type=expressionType(receiver,c);var struct=c.types().structs.get(type.name());
|
||||
var type=expressionType(receiver,c);var struct=c.types().struct(type);
|
||||
var name=target.pathSegments().getLast();int field=0;
|
||||
while(!struct.fields().get(field).name().equals(name))field++;
|
||||
var fieldType=struct.fields().get(field).typeRef();int width=c.types().slots(fieldType);
|
||||
@@ -2084,6 +2097,7 @@ final class PbsExecutableBodyLowerer {
|
||||
registry(STRUCT_SET,c.types().registryType(type),field,1+storageWidth(fieldType,c),0,statement.span(),c);
|
||||
}
|
||||
private boolean lowerStructuredCall(PbsAst.CallExpr call,PbsExecutableLoweringContext c) {
|
||||
recordCallFacts(call, c);
|
||||
if (call.callee() instanceof PbsAst.IdentifierExpr name && c.types().functions.containsKey(name.name())) {
|
||||
var method = sourceFunction(call,c);
|
||||
if (method == null) return false;
|
||||
@@ -2115,7 +2129,7 @@ final class PbsExecutableBodyLowerer {
|
||||
emitLoadLocalSlots(receiverView, 2, member.receiver().span(), c);
|
||||
registry(CALL_TRAIT,c.types().registryType(owner),ordinal,pops,c.types().returnSlots(method.returnKind(),method.returnType()),call.span(),c);return true;
|
||||
}
|
||||
var service=c.types().services.get(owner.name());
|
||||
var service=c.types().service(owner);
|
||||
if(service!=null) {
|
||||
var method=service.methods().stream().filter(m->m.name().equals(member.memberName())&¶metersMatch(m.parameters(),call.arguments(),c) && returnMatches(m.returnType(),owner.name(),c)).findFirst().orElse(null);
|
||||
if(method==null)return false;
|
||||
@@ -2131,7 +2145,7 @@ final class PbsExecutableBodyLowerer {
|
||||
}
|
||||
emitStructuredFunction(owner.name()+"."+method.name(),method.parameters().stream().map(PbsAst.Parameter::typeRef).toList(),PbsTypeSubstitution.replaceSelf(method.returnType(),owner.name()),method.returnKind(),method.resultErrorType(),pops,c.types().returnSlots(method.returnKind(),method.returnType()),call.span(),c);return true;
|
||||
}
|
||||
var struct=c.types().structs.get(owner.name());if(struct==null)return false;
|
||||
var struct=c.types().struct(owner);if(struct==null)return false;
|
||||
boolean listIndex=p.studio.compiler.pbs.PbsSdkCollections.isIndexedCollection(struct) && java.util.Set.of("insert","clearAt","removeAt","resize","reserve").contains(member.memberName());
|
||||
var method=struct.methods().stream().filter(m->m.name().equals(member.memberName())&¶metersMatch(m.parameters(),call.arguments(),c,listIndex) && returnMatches(m.returnType(),owner.name(),c)).findFirst().orElse(null);
|
||||
if(method==null)return false;
|
||||
@@ -2228,7 +2242,14 @@ final class PbsExecutableBodyLowerer {
|
||||
PbsAst.ReturnKind kind, PbsAst.TypeRef errorType, int pops, int pushes, Span span, PbsExecutableLoweringContext c) {
|
||||
var callableId = c.exactLocalCallable(name, parameters, returnType, kind, errorType);
|
||||
if (callableId == null) {
|
||||
reportUnsupportedLowering("Structured call requires exact overload: " + name, span, c);
|
||||
var facts = new java.util.LinkedHashMap<>(c.lastCallFacts);
|
||||
facts.put("requestedSymbol", name); facts.put("lookupOwnerKey", name);
|
||||
facts.put("parameterTypes", parameters.stream().map(c.types()::canonical).toList());
|
||||
facts.put("lookupReturnType", c.types().canonical(returnType)); facts.put("lookupResult", "unresolved");
|
||||
p.studio.compiler.pbs.PbsDiagnosticFacts.error(c.diagnostics(),
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(),
|
||||
"Structured call requires exact overload: " + name, span, "pbs.lowering.structured-overload", facts,
|
||||
p.studio.compiler.source.diagnostics.FailureKind.PROGRAM_REJECTION);
|
||||
return;
|
||||
}
|
||||
c.instructions().add(new IRBackendExecutableFunction.Instruction(IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||
@@ -2236,6 +2257,32 @@ final class PbsExecutableBodyLowerer {
|
||||
c.callableSignatureByCallableId().get(callableId).callableName(), callableId, null, null, pops, pushes, span));
|
||||
}
|
||||
|
||||
private void recordCallFacts(PbsAst.CallExpr call, PbsExecutableLoweringContext c) {
|
||||
var facts = new java.util.LinkedHashMap<String, Object>();
|
||||
facts.put("construction", "call"); facts.put("requestedSymbol", p.studio.compiler.pbs.PbsDiagnosticFacts.symbol(call.callee()));
|
||||
facts.put("argumentCount", call.arguments().size());
|
||||
facts.put("resolutionConstraints", c.expectedType == null ? null : c.types().canonical(c.expectedType));
|
||||
facts.put("enclosingReturnType", c.types().canonical(c.returnType));
|
||||
facts.put("serviceOwner", c.serviceOwner);
|
||||
if (call.callee() instanceof PbsAst.MemberExpr member) {
|
||||
var receiver = PbsRuntimeTypes.unwrap(expressionType(member.receiver(), c));
|
||||
facts.put("receiver", p.studio.compiler.pbs.PbsDiagnosticFacts.symbol(member.receiver()));
|
||||
facts.put("receiverType", receiver == null ? null : c.types().canonical(receiver));
|
||||
if (receiver != null) {
|
||||
var struct = c.types().struct(receiver);
|
||||
var service = c.types().service(receiver);
|
||||
var methods = struct != null ? struct.methods().asList() : service != null ? service.methods().asList() : java.util.List.<PbsAst.FunctionDecl>of();
|
||||
facts.put("declaredTypes", methods.stream().filter(m -> m.name().equals(member.memberName()))
|
||||
.map(m -> c.types().canonical(m.returnType())).toList());
|
||||
facts.put("lookupOwnerKey", receiver.name() + "." + member.memberName());
|
||||
}
|
||||
} else if (call.callee() instanceof PbsAst.IdentifierExpr name) {
|
||||
facts.put("declaredTypes", c.types().functions.getOrDefault(name.name(), java.util.List.of()).stream()
|
||||
.map(f -> c.types().canonical(f.returnType())).toList());
|
||||
}
|
||||
c.lastCallFacts = p.studio.utilities.json.ImmutableJson.object(facts);
|
||||
}
|
||||
|
||||
private void lowerServiceValue(String name,Span span,PbsExecutableLoweringContext c) {
|
||||
var slot=c.resolveGlobalSlot("$service."+name);
|
||||
if(slot==null){emitStructuredFunction(name+".$instance",java.util.List.of(),PbsRuntimeTypes.type(name),0,1,span,c);return;}
|
||||
|
||||
+7
-1
@@ -59,6 +59,11 @@ public final class PbsExecutableCallableRegistryFactory {
|
||||
importedCallables,
|
||||
builtinCanonicalBySourceType);
|
||||
|
||||
var ownerDeclarations = new HashMap<CallableId,java.util.Set<p.studio.compiler.source.Span>>();
|
||||
for (var imported : importedCallables) if (!imported.ownerDeclaration().isNone()) {
|
||||
var id = callableIdTable.register(imported.moduleId(),imported.targetName(),imported.arity(),imported.shapeSurface());
|
||||
ownerDeclarations.computeIfAbsent(id, ignored -> new java.util.HashSet<>()).add(imported.ownerDeclaration());
|
||||
}
|
||||
final var callableSignatureByCallableId = new HashMap<CallableId, CallableSignatureRef>();
|
||||
final var callableSignatures = new ArrayList<CallableSignatureRef>(callableIdTable.size());
|
||||
for (final var callableId : callableIdTable.identifiers()) {
|
||||
@@ -71,6 +76,7 @@ public final class PbsExecutableCallableRegistryFactory {
|
||||
callableIdByDeclaration,
|
||||
callableIdsByNameAndArity,
|
||||
callableSignatureByCallableId,
|
||||
ownerDeclarations,
|
||||
returnSlotsByCallableId,
|
||||
returnOwnerByCallableId,
|
||||
tupleProjectionByCallableId,
|
||||
@@ -139,7 +145,7 @@ public final class PbsExecutableCallableRegistryFactory {
|
||||
|
||||
public static PbsAst.FunctionDecl withReceiver(PbsAst.FunctionDecl function,String owner,String receiver) {
|
||||
var params=new ArrayList<PbsAst.Parameter>();
|
||||
params.add(new PbsAst.Parameter(receiver,PbsRuntimeTypes.type(owner),function.span()));
|
||||
params.add(new PbsAst.Parameter(receiver,PbsAst.TypeRef.simple(owner,function.span()),function.span()));
|
||||
for(var p:function.parameters()) params.add(new PbsAst.Parameter(p.name(),PbsTypeSubstitution.replaceSelf(p.typeRef(),owner),p.span()));
|
||||
return new PbsAst.FunctionDecl(function.name(),ReadOnlyList.wrap(params),function.returnKind(),
|
||||
PbsTypeSubstitution.replaceSelf(function.returnType(),owner),function.resultErrorType(),function.attributes(),function.lifecycleMarker(),function.body(),function.span());
|
||||
|
||||
+4
-7
@@ -442,12 +442,9 @@ final class PbsExecutableCallsiteEmitter {
|
||||
final String message,
|
||||
final p.studio.compiler.source.Span span,
|
||||
final PbsExecutableLoweringContext context) {
|
||||
context.diagnostics().error(
|
||||
DiagnosticPhase.STATIC_SEMANTICS,
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(),
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(),
|
||||
Map.of(),
|
||||
message,
|
||||
span);
|
||||
p.studio.compiler.pbs.PbsDiagnosticFacts.error(context.diagnostics(),
|
||||
PbsSemanticsErrors.E_SEM_EXEC_LOWERING_UNRESOLVED_CALLEE.name(), message, span,
|
||||
"pbs.lowering.call-resolution", context.lastCallFacts,
|
||||
p.studio.compiler.source.diagnostics.FailureKind.PROGRAM_REJECTION);
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -30,6 +30,7 @@ final class PbsExecutableLoweringContext {
|
||||
p.studio.compiler.pbs.ast.PbsAst.ReturnKind returnKind;
|
||||
p.studio.compiler.pbs.ast.PbsAst.TypeRef resultErrorType;
|
||||
String serviceOwner;
|
||||
java.util.Map<String, Object> lastCallFacts = java.util.Map.of();
|
||||
private int nextLabelId = 0;
|
||||
private int nextLocalSlot;
|
||||
|
||||
@@ -127,8 +128,12 @@ final class PbsExecutableLoweringContext {
|
||||
output = "result<" + formatter.typeSurfaceKey(errorType) + ">" + formatter.typeSurfaceKey(returnType);
|
||||
final var expectedOutput = output;
|
||||
var importedIds = callableIdsByNameAndArity().getOrDefault(new PbsCallableResolutionKey(nameTable().register(name), parameterTypes.size()), java.util.List.of());
|
||||
var separator = name.indexOf('.');
|
||||
var ownerDeclaration = separator < 0 ? null : types().contractTypes.declaration(types().sourceType(name.substring(0,separator)));
|
||||
var candidates = callableSignatureByCallableId().entrySet().stream().filter(entry ->
|
||||
importedIds.contains(entry.getKey()) && entry.getValue().arity() == parameterTypes.size()
|
||||
&& (ownerDeclaration == null || callableRegistry.ownerDeclarations().getOrDefault(entry.getKey(), java.util.Set.of()).isEmpty()
|
||||
|| callableRegistry.ownerDeclarations().get(entry.getKey()).contains(ownerDeclaration.span()))
|
||||
&& normalizeShape(entry.getValue().typeShape()).equals(normalizeShape(inputs + expectedOutput))).toList();
|
||||
if (candidates.size() == 1) return candidates.getFirst().getKey();
|
||||
return null;
|
||||
|
||||
+1
@@ -60,6 +60,7 @@ public class PbsExecutableLoweringModels {
|
||||
Map<PbsLowerableCallable, CallableId> callableIdByDeclaration,
|
||||
Map<PbsCallableResolutionKey, List<CallableId>> callableIdsByNameAndArity,
|
||||
Map<CallableId, CallableSignatureRef> callableSignatureByCallableId,
|
||||
Map<CallableId, java.util.Set<p.studio.compiler.source.Span>> ownerDeclarations,
|
||||
Map<CallableId, Integer> returnSlotsByCallableId,
|
||||
Map<CallableId, String> returnOwnerByCallableId,
|
||||
Map<CallableId, PbsTupleProjection> tupleProjectionByCallableId,
|
||||
|
||||
+7
-3
@@ -32,7 +32,8 @@ public final class PbsExecutableLoweringService {
|
||||
final NameTable nameTable,
|
||||
final FESurfaceContext feSurfaceContext,
|
||||
final DiagnosticSink diagnostics,
|
||||
final ReadOnlyList<PbsFrontendCompiler.ImportedCallableSurface> importedCallables) {
|
||||
final ReadOnlyList<PbsFrontendCompiler.ImportedCallableSurface> importedCallables,
|
||||
final ReadOnlyList<PbsFrontendCompiler.ImportedGlobalSurface> importedGlobals) {
|
||||
final var normalizedModuleId = moduleId == null ? ModuleId.none() : moduleId;
|
||||
final var metadataIndex = metadataIndexFactory.create(
|
||||
ast,
|
||||
@@ -40,7 +41,7 @@ public final class PbsExecutableLoweringService {
|
||||
reservedMetadata,
|
||||
nameTable,
|
||||
feSurfaceContext,
|
||||
diagnostics);
|
||||
diagnostics, importedGlobals);
|
||||
final var callableRegistry = callableRegistryFactory.create(
|
||||
ast,
|
||||
normalizedModuleId,
|
||||
@@ -157,7 +158,10 @@ public final class PbsExecutableLoweringService {
|
||||
loweredBody.maxStackSlots(),
|
||||
loweredBody.instructions(),
|
||||
functionDecl.span(),
|
||||
metadataIndex.types().metadata(functionDecl));
|
||||
metadataIndex.types().metadata(functionDecl),
|
||||
p.studio.utilities.json.ImmutableJson.fields("construction", "function", "symbol", callable.callableName(),
|
||||
"declaredTypes", metadataIndex.types().canonical(functionDecl.returnType()),
|
||||
"parameterTypes", functionDecl.parameters().stream().map(p -> metadataIndex.types().canonical(p.typeRef())).toList()));
|
||||
}
|
||||
|
||||
private int safeToInt(final long value) {
|
||||
|
||||
+9
-1
@@ -26,12 +26,20 @@ final class PbsExecutableMetadataIndexFactory {
|
||||
final IRReservedMetadata reservedMetadata,
|
||||
final NameTable nameTable,
|
||||
final FESurfaceContext feSurfaceContext,
|
||||
final DiagnosticSink diagnostics) {
|
||||
final DiagnosticSink diagnostics,
|
||||
final ReadOnlyList<p.studio.compiler.pbs.PbsFrontendCompiler.ImportedGlobalSurface> importedGlobals) {
|
||||
final var hostByMethodName = indexHostBindingsByMethodName(reservedMetadata, nameTable);
|
||||
final var builtinCanonicalBySourceType = indexBuiltinCanonicalBySourceType(reservedMetadata);
|
||||
final var builtinConstOwnerByNameId = indexBuiltinConstOwners(reservedMetadata, nameTable);
|
||||
final var builtinConstByNameId = indexBuiltinConstSurfaces(reservedMetadata, nameTable);
|
||||
final var globalSlotByNameId = indexGlobalSlots(ast, nameTable);
|
||||
var ownedNames = new java.util.HashSet<String>();
|
||||
for (var declaration : ast.topDecls()) {
|
||||
if (declaration instanceof PbsAst.GlobalDecl global) ownedNames.add(global.name());
|
||||
if (declaration instanceof PbsAst.ServiceDecl service) ownedNames.add("$service."+service.name());
|
||||
}
|
||||
final var importedGlobalsBySlot = PbsImportedGlobalSlots.index(ownedNames, importedGlobals);
|
||||
importedGlobalsBySlot.forEach((slot,global) -> globalSlotByNameId.put(nameTable.register(global.localName()),slot));
|
||||
final var constDeclByNameId = indexConstDecls(ast, nameTable);
|
||||
final var addressableByAddress = indexAddressables(feSurfaceContext);
|
||||
final var builtinSignatureByOwnerAndMethod = indexBuiltinSignatures(
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package p.studio.compiler.pbs.lowering;
|
||||
|
||||
import p.studio.compiler.pbs.PbsFrontendCompiler.ImportedGlobalSurface;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
import java.util.*;
|
||||
|
||||
/** PBS-private temporary operands; all are resolved before common IR is published. */
|
||||
public final class PbsImportedGlobalSlots {
|
||||
private PbsImportedGlobalSlots() {}
|
||||
public static Map<Integer, ImportedGlobalSurface> index(Set<String> ownedNames, ReadOnlyList<ImportedGlobalSurface> imports) {
|
||||
var result = new LinkedHashMap<Integer, ImportedGlobalSurface>();
|
||||
var names = new HashSet<>(ownedNames);
|
||||
for (var imported : imports) if (imported.directlyVisible() && names.add(imported.localName()))
|
||||
result.put(Integer.MAX_VALUE - result.size(), imported);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+21
-5
@@ -11,6 +11,7 @@ final class PbsRuntimeTypes {
|
||||
record ClosureBody(PbsAst.FunctionDecl function, java.util.List<PbsAst.NamedTypeField> captures) {}
|
||||
final java.util.List<ClosureBody> closureBodies = new ArrayList<>();
|
||||
final Map<String, java.util.List<PbsAst.NamedTypeField>> capturesByFunction = new HashMap<>();
|
||||
private final Span sourceScope;
|
||||
final Map<String, String> builtinNames;
|
||||
final Map<String, String> aliases = new HashMap<>();
|
||||
final Map<String, ReadOnlyList<PbsAst.BuiltinFieldDecl>> fields = new HashMap<>();
|
||||
@@ -30,6 +31,7 @@ final class PbsRuntimeTypes {
|
||||
final List<IRRegistry.Implementation> runtimeImplementations = new ArrayList<>();
|
||||
|
||||
PbsRuntimeTypes(PbsAst.File ast, ReadOnlyList<PbsAst.TopDecl> supplemental, Map<String,String> builtins) {
|
||||
sourceScope = ast.span();
|
||||
builtinNames = builtins;
|
||||
ast.topDecls().forEach(d -> allowedFactoryOrigins.add(d.span()));
|
||||
supplemental.forEach(d -> { if (d instanceof PbsAst.TypeBindingDecl b && b.sameModule() && b.span().getFileId().equals(ast.span().getFileId())) allowedFactoryOrigins.add(b.declaration().span()); });
|
||||
@@ -82,9 +84,23 @@ final class PbsRuntimeTypes {
|
||||
private void addSignature(String name, PbsAst.FunctionDecl f) {
|
||||
signatures.put(name+"#"+f.parameters().size(), new PbsAst.FunctionSignature(f.name(), f.parameters(), f.returnKind(), f.returnType(), f.resultErrorType(), f.attributes(), f.span()));
|
||||
}
|
||||
boolean isContract(PbsAst.TypeRef type) { return contractTypes.isContract(unwrap(type)); }
|
||||
PbsAst.TypeRef sourceType(String name) { return PbsAst.TypeRef.simple(name, sourceScope); }
|
||||
private PbsAst.TypeRef lexical(PbsAst.TypeRef type) {
|
||||
type = unwrap(type);
|
||||
return type != null && type.kind() == PbsAst.TypeRefKind.SIMPLE && type.span().isNone()
|
||||
? sourceType(type.name()) : type;
|
||||
}
|
||||
PbsAst.StructDecl struct(PbsAst.TypeRef type) {
|
||||
var declaration = contractTypes.declaration(lexical(type));
|
||||
return declaration instanceof PbsAst.StructDecl struct ? struct : declaration == null && type != null ? structs.get(type.name()) : null;
|
||||
}
|
||||
PbsAst.ServiceDecl service(PbsAst.TypeRef type) {
|
||||
var declaration = contractTypes.declaration(lexical(type));
|
||||
return declaration instanceof PbsAst.ServiceDecl service ? service : declaration == null && type != null ? services.get(type.name()) : null;
|
||||
}
|
||||
boolean isContract(PbsAst.TypeRef type) { return contractTypes.isContract(lexical(type)); }
|
||||
PbsAst.ContractDecl contract(PbsAst.TypeRef type) {
|
||||
var instance = contractTypes.resolve(unwrap(type));
|
||||
var instance = contractTypes.resolve(lexical(type));
|
||||
return instance == null ? null : instance.declaration();
|
||||
}
|
||||
String implementationCallableName(PbsAst.ImplementsDecl implementation, String method) {
|
||||
@@ -109,7 +125,7 @@ final class PbsRuntimeTypes {
|
||||
return t;
|
||||
}
|
||||
String key(PbsAst.TypeRef t) {
|
||||
t = unwrap(t);
|
||||
t = lexical(t);
|
||||
if (t == null) return "void";
|
||||
if (t.kind() == PbsAst.TypeRefKind.FN) return "Fn(" + t.fields().stream().map(f->key(f.typeRef())).collect(java.util.stream.Collectors.joining(",")) + ")->" + shapeKey(t.inner());
|
||||
if (t.kind() == PbsAst.TypeRefKind.ARRAY) return "array("+key(t.inner())+")";
|
||||
@@ -128,7 +144,7 @@ final class PbsRuntimeTypes {
|
||||
return canonical(t);
|
||||
}
|
||||
String shapeKey(PbsAst.TypeRef type) {
|
||||
var t = unwrap(type);
|
||||
var t = lexical(type);
|
||||
if (t == null || t.kind() == PbsAst.TypeRefKind.UNIT) return "";
|
||||
if (t.kind() == PbsAst.TypeRefKind.NAMED_TUPLE) return t.fields().stream()
|
||||
.map(field -> shapeKey(field.typeRef())).collect(java.util.stream.Collectors.joining(","));
|
||||
@@ -169,7 +185,7 @@ final class PbsRuntimeTypes {
|
||||
return ref;
|
||||
}
|
||||
IRRegistry.TypeRef registryType(PbsAst.TypeRef type) {
|
||||
var t = unwrap(type);
|
||||
var t = lexical(type);
|
||||
if (p.studio.compiler.pbs.PbsSdkMemcard.isBuffer(contractTypes.declaration(t))) return memcardBufferStorage();
|
||||
if (t.kind() == PbsAst.TypeRefKind.FN) {
|
||||
var ref = new IRRegistry.TypeRef("pbs:" + key(t));
|
||||
|
||||
+10
-4
@@ -127,10 +127,13 @@ final class PbsFlowAssignmentAnalyzer {
|
||||
return new AssignmentTargetResolution(TypeView.unknown(), false);
|
||||
}
|
||||
|
||||
Diagnostics.error(diagnostics,
|
||||
p.studio.compiler.pbs.PbsDiagnosticFacts.error(diagnostics,
|
||||
PbsSemanticsErrors.E_SEM_ASSIGN_TARGET_UNRESOLVED.name(),
|
||||
"Assignment target '%s' does not resolve".formatted(rootName),
|
||||
lValue.span());
|
||||
lValue.span(), "pbs.flow.assignment-target", p.studio.utilities.json.ImmutableJson.fields(
|
||||
"construction", "assignment", "requestedSymbol", rootName, "binding", "unresolved",
|
||||
"scopeFileId", lValue.span().getFileId().getId()),
|
||||
p.studio.compiler.source.diagnostics.FailureKind.PROGRAM_REJECTION);
|
||||
return new AssignmentTargetResolution(TypeView.unknown(), false);
|
||||
}
|
||||
|
||||
@@ -156,10 +159,13 @@ final class PbsFlowAssignmentAnalyzer {
|
||||
} else if (model.constTypes.containsKey(rootName)) {
|
||||
currentType = model.constTypes.get(rootName);
|
||||
} else {
|
||||
Diagnostics.error(diagnostics,
|
||||
p.studio.compiler.pbs.PbsDiagnosticFacts.error(diagnostics,
|
||||
PbsSemanticsErrors.E_SEM_ASSIGN_TARGET_UNRESOLVED.name(),
|
||||
"Assignment target '%s' does not resolve".formatted(rootName),
|
||||
lValue.span());
|
||||
lValue.span(), "pbs.flow.assignment-target", p.studio.utilities.json.ImmutableJson.fields(
|
||||
"construction", "assignment", "requestedSymbol", rootName, "binding", "unresolved",
|
||||
"scopeFileId", lValue.span().getFileId().getId()),
|
||||
p.studio.compiler.source.diagnostics.FailureKind.PROGRAM_REJECTION);
|
||||
return new AssignmentTargetResolution(TypeView.unknown(), false);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -79,7 +79,7 @@ final class PbsFlowCallableResolutionAnalyzer {
|
||||
callee,
|
||||
argumentType,
|
||||
context.expectedType(),
|
||||
context.diagnostics());
|
||||
context.diagnostics(), p.studio.compiler.pbs.PbsDiagnosticFacts.symbol(callExpr.callee()));
|
||||
}
|
||||
|
||||
ExprResult analyzeApplyExpression(
|
||||
@@ -125,7 +125,7 @@ final class PbsFlowCallableResolutionAnalyzer {
|
||||
callee,
|
||||
argument,
|
||||
context.expectedType(),
|
||||
context.diagnostics());
|
||||
context.diagnostics(), p.studio.compiler.pbs.PbsDiagnosticFacts.symbol(applyExpr.callee()));
|
||||
}
|
||||
|
||||
ExprResult analyzeMemberExpression(
|
||||
@@ -295,13 +295,18 @@ final class PbsFlowCallableResolutionAnalyzer {
|
||||
final ExprResult callee,
|
||||
final TypeView argumentType,
|
||||
final TypeView expectedType,
|
||||
final DiagnosticSink diagnostics) {
|
||||
final DiagnosticSink diagnostics, final String requestedSymbol) {
|
||||
final var candidates = callee.callables();
|
||||
if (candidates.isEmpty()) {
|
||||
Diagnostics.error(diagnostics,
|
||||
p.studio.compiler.pbs.PbsDiagnosticFacts.error(diagnostics,
|
||||
PbsSemanticsErrors.E_SEM_APPLY_NON_CALLABLE_TARGET.name(),
|
||||
"Apply/call target is not callable",
|
||||
calleeSpan);
|
||||
calleeSpan, "pbs.flow.call-target", p.studio.utilities.json.ImmutableJson.fields(
|
||||
"construction", "application", "requestedSymbol", requestedSymbol,
|
||||
"calleeClassification", callee.type().kind().name(), "argumentType", argumentType.kind().name(),
|
||||
"resolutionConstraints", expectedType == null ? null : expectedType.kind().name(),
|
||||
"candidateCount", candidates.size(), "scopeFileId", calleeSpan.getFileId().getId()),
|
||||
p.studio.compiler.source.diagnostics.FailureKind.PROGRAM_REJECTION);
|
||||
return ExprResult.type(TypeView.unknown());
|
||||
}
|
||||
|
||||
|
||||
+10
-7
@@ -58,16 +58,17 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
final var nameTable = ctx.nameTable();
|
||||
final var feSurfaceContext = ctx.feSurfaceContext();
|
||||
final var assembly = moduleAssemblyService.assemble(ctx, nameTable, diagnostics, issues);
|
||||
final var sourceContexts = importedSemanticContextService.build(assembly.parsedSourceFiles(), assembly.moduleTable());
|
||||
final var sourceContexts = importedSemanticContextService.build(assembly.parsedSourceFiles(), assembly.moduleTable(), assembly.siblingDeclarationsByModule());
|
||||
final var parsedSourceFiles = new PbsGenericProgramService().prepare(assembly.parsedSourceFiles(), sourceContexts,
|
||||
assembly.moduleTable(), diagnostics, feSurfaceContext);
|
||||
final var importedSemanticContexts = importedSemanticContextService.build(parsedSourceFiles, assembly.moduleTable());
|
||||
final var importedSemanticContexts = importedSemanticContextService.build(parsedSourceFiles, assembly.moduleTable(), assembly.siblingDeclarationsByModule());
|
||||
projectLifecycleSemanticsValidator.validate(parsedSourceFiles.asList(), diagnostics);
|
||||
final var failedModuleIds = assembly.mutableFailedModuleIds();
|
||||
final var moduleDependencyGraph = assembly.moduleDependencyGraph();
|
||||
final var canonicalModulePool = assembly.canonicalModulePool();
|
||||
|
||||
final var compiledSourceFiles = new ArrayList<CompiledSourceFile>(parsedSourceFiles.size());
|
||||
final var importedGlobalsByFile = new HashMap<FileId,ReadOnlyList<PbsFrontendCompiler.ImportedGlobalSurface>>();
|
||||
for (final var parsedSource : parsedSourceFiles) {
|
||||
final var blockedModuleIds = blockedModulesByDependency(failedModuleIds, moduleDependencyGraph);
|
||||
if (blockedModuleIds.contains(parsedSource.moduleId())) {
|
||||
@@ -96,12 +97,13 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
failedModuleIds.add(parsedSource.moduleId());
|
||||
}
|
||||
compiledSourceFiles.add(new CompiledSourceFile(parsedSource.moduleId(), irBackendFile));
|
||||
importedGlobalsByFile.put(parsedSource.fileId(), importedSemanticContext.importedGlobals());
|
||||
}
|
||||
|
||||
final var irBackend = mergeCompiledSources(
|
||||
compiledSourceFiles,
|
||||
failedModuleIds,
|
||||
moduleDependencyGraph);
|
||||
moduleDependencyGraph, importedGlobalsByFile);
|
||||
logs.using(log).debug("PBS frontend lowered to IR BE:\n%s".formatted(irBackend));
|
||||
return irBackend;
|
||||
}
|
||||
@@ -128,10 +130,10 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
final var assembly = service.moduleAssemblyService.assemble(ctx, ctx.nameTable(), diagnostics, issues);
|
||||
final var importedSemanticContexts = service.importedSemanticContextService.build(
|
||||
assembly.parsedSourceFiles(),
|
||||
assembly.moduleTable());
|
||||
assembly.moduleTable(), assembly.siblingDeclarationsByModule());
|
||||
final var semanticFiles = new PbsGenericProgramService().prepare(assembly.parsedSourceFiles(), importedSemanticContexts,
|
||||
assembly.moduleTable(), diagnostics, ctx.feSurfaceContext());
|
||||
final var semanticContexts = service.importedSemanticContextService.build(semanticFiles, assembly.moduleTable());
|
||||
final var semanticContexts = service.importedSemanticContextService.build(semanticFiles, assembly.moduleTable(), assembly.siblingDeclarationsByModule());
|
||||
final var semanticAstByFile = new HashMap<FileId, p.studio.compiler.pbs.ast.PbsAst.File>();
|
||||
semanticFiles.forEach(f -> semanticAstByFile.put(f.fileId(), f.ast()));
|
||||
final var flowSemanticsValidator = new PbsFlowSemanticsValidator();
|
||||
@@ -246,7 +248,8 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
private IRBackend mergeCompiledSources(
|
||||
final ArrayList<CompiledSourceFile> compiledSourceFiles,
|
||||
final Set<ModuleId> failedModuleIds,
|
||||
final Map<ModuleId, ReadOnlyList<ModuleId>> moduleDependencyGraph) {
|
||||
final Map<ModuleId, ReadOnlyList<ModuleId>> moduleDependencyGraph,
|
||||
final Map<FileId,ReadOnlyList<PbsFrontendCompiler.ImportedGlobalSurface>> importedGlobalsByFile) {
|
||||
final var irBackendAggregator = IRBackend.aggregator();
|
||||
final var blockedModuleIds = blockedModulesByDependency(failedModuleIds, moduleDependencyGraph);
|
||||
|
||||
@@ -260,7 +263,7 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
|
||||
compiledSourceFiles,
|
||||
blockedModuleIds,
|
||||
moduleDependencyGraph));
|
||||
return irBackendAggregator.emit();
|
||||
return PbsGlobalReferenceLinker.resolve(irBackendAggregator.emit(),importedGlobalsByFile);
|
||||
}
|
||||
|
||||
private ReadOnlyList<ModuleId> lifecycleModuleOrder(
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import p.studio.compiler.models.*;
|
||||
import p.studio.compiler.source.identifiers.ModuleId;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
import java.util.*;
|
||||
|
||||
/** Resolves PBS-private symbolic global references before publishing common IR. No storage is cloned. */
|
||||
final class PbsGlobalReferenceLinker {
|
||||
private record Key(p.studio.compiler.source.identifiers.FileId file, String name) {}
|
||||
static IRBackend resolve(IRBackend backend, Map<p.studio.compiler.source.identifiers.FileId,ReadOnlyList<p.studio.compiler.pbs.PbsFrontendCompiler.ImportedGlobalSurface>> imports) {
|
||||
if (imports.values().stream().noneMatch(values -> values.stream().anyMatch(p.studio.compiler.pbs.PbsFrontendCompiler.ImportedGlobalSurface::directlyVisible))) return backend;
|
||||
var globals = new HashMap<Key, IRGlobal>();
|
||||
for (var global : backend.getGlobals()) globals.put(new Key(global.fileId(),global.name()), global);
|
||||
var functions = new ArrayList<IRBackendExecutableFunction>();
|
||||
for (var function : backend.getExecutableFunctions()) {
|
||||
var ownedNames = new HashSet<String>();
|
||||
for (var global : backend.getGlobals()) if (global.fileId().equals(function.fileId())) ownedNames.add(global.name());
|
||||
var importedSlots = p.studio.compiler.pbs.lowering.PbsImportedGlobalSlots.index(ownedNames,imports.getOrDefault(function.fileId(),ReadOnlyList.empty()));
|
||||
if (importedSlots.isEmpty()) { functions.add(function); continue; }
|
||||
var instructions = new ArrayList<IRBackendExecutableFunction.Instruction>();
|
||||
for (var instruction : function.instructions()) {
|
||||
if ((instruction.kind()==IRBackendExecutableFunction.InstructionKind.GET_GLOBAL || instruction.kind()==IRBackendExecutableFunction.InstructionKind.SET_GLOBAL)
|
||||
&& importedSlots.containsKey(instruction.expectedArgSlots())) {
|
||||
var imported = importedSlots.get(instruction.expectedArgSlots());
|
||||
var global = Objects.requireNonNull(globals.get(new Key(imported.span().getFileId(),imported.globalName())), "Visible PBS global binding has no defining storage");
|
||||
instruction = new IRBackendExecutableFunction.Instruction(instruction.kind(),ModuleId.none(),"",null,null,null,
|
||||
instruction.label(),instruction.targetLabel(),global.slot(),instruction.expectedRetSlots(),instruction.span(),instruction.registryInstruction());
|
||||
}
|
||||
instructions.add(instruction);
|
||||
}
|
||||
functions.add(new IRBackendExecutableFunction(function.fileId(),function.moduleId(),function.callableName(),function.callableId(),function.sourceStart(),function.sourceEnd(),
|
||||
function.paramSlots(),function.localSlots(),function.returnSlots(),function.maxStackSlots(),ReadOnlyList.wrap(instructions),function.span(),function.metadata(),function.semanticFacts()));
|
||||
}
|
||||
return IRBackend.builder().entryPointCallableName(backend.getEntryPointCallableName()).entryPointModuleId(backend.getEntryPointModuleId())
|
||||
.functions(backend.getFunctions()).syntheticFunctions(backend.getSyntheticFunctions()).globals(backend.getGlobals()).executableFunctions(ReadOnlyList.wrap(functions))
|
||||
.modulePool(backend.getModulePool()).callableSignatures(backend.getCallableSignatures()).intrinsicPool(backend.getIntrinsicPool())
|
||||
.reservedMetadata(backend.getReservedMetadata()).registry(backend.getRegistry()).lifecycleDeclaration(backend.getLifecycleDeclaration()).build();
|
||||
}
|
||||
}
|
||||
+39
-8
@@ -26,7 +26,8 @@ final class PbsImportedSemanticContextService {
|
||||
|
||||
Map<FileId, PbsImportedSemanticContext> build(
|
||||
final ReadOnlyList<PbsParsedSourceFile> parsedSourceFiles,
|
||||
final ModuleTable moduleTable) {
|
||||
final ModuleTable moduleTable,
|
||||
final Map<ModuleId, Set<p.studio.compiler.source.Span>> siblingDeclarationsByModule) {
|
||||
final Map<ModuleId, ArrayList<PbsParsedSourceFile>> sourcesByModule = new HashMap<>();
|
||||
for (final var parsedSource : parsedSourceFiles) {
|
||||
sourcesByModule
|
||||
@@ -83,9 +84,39 @@ final class PbsImportedSemanticContextService {
|
||||
for (var sibling : sourcesByModule.getOrDefault(parsedSource.moduleId(), new ArrayList<>())) {
|
||||
if (sibling.fileId().equals(parsedSource.fileId())) continue;
|
||||
for (var declaration : sibling.ast().topDecls()) {
|
||||
if (isTypeDecl(declaration) || declaration instanceof PbsAst.FunctionDecl f && !f.typeParameters().isEmpty()) appendSupplementalTopDecl(
|
||||
new PbsAst.TypeBindingDecl(topDeclName(declaration), declaration, parsedSource.ast().span(), true), supplementalTopDecls, supplementalKeys);
|
||||
if (declaration instanceof PbsAst.ImplementsDecl) appendSupplementalTopDecl(declaration, supplementalTopDecls, supplementalKeys);
|
||||
boolean admitted = siblingDeclarationsByModule.getOrDefault(parsedSource.moduleId(), Set.of()).contains(declaration.span());
|
||||
if (admitted) {
|
||||
if (isTypeDecl(declaration) || declaration instanceof PbsAst.FunctionDecl f && !f.typeParameters().isEmpty())
|
||||
appendSupplementalTopDecl(new PbsAst.TypeBindingDecl(topDeclName(declaration), declaration, parsedSource.ast().span(), true), supplementalTopDecls, supplementalKeys);
|
||||
else appendSupplementalTopDecl(declaration, supplementalTopDecls, supplementalKeys);
|
||||
appendTypeDependencyDecls(declaration, topDeclsByNameByModule.get(parsedSource.moduleId()), supplementalTopDecls, supplementalKeys);
|
||||
if (declaration instanceof PbsAst.FunctionDecl function && function.typeParameters().isEmpty())
|
||||
appendImportedCallable(importedCallables, importedCallableKeys, new PbsFrontendCompiler.ImportedCallableSurface(
|
||||
parsedSource.moduleId(), function.name(), function.parameters().size(), returnSlotsFor(function),
|
||||
function.returnKind(), function.returnType(), frontendCompiler.callableShapeSurfaceOf(function), function.name()));
|
||||
if (declaration instanceof PbsAst.GlobalDecl global)
|
||||
directlyVisibleGlobalRefs.putIfAbsent(global.name(), new PbsGlobalDependencySupport.GlobalRef(parsedSource.moduleId(),global.name()));
|
||||
if (declaration instanceof PbsAst.ServiceDecl service) {
|
||||
var accessor = p.studio.compiler.pbs.lowering.PbsExecutableCallableRegistryFactory.singletonAccessor(service);
|
||||
appendImportedCallable(importedCallables, importedCallableKeys, new PbsFrontendCompiler.ImportedCallableSurface(
|
||||
parsedSource.moduleId(),service.name()+".$instance",0,1,accessor.returnKind(),accessor.returnType(),
|
||||
frontendCompiler.callableShapeSurfaceOf(accessor),service.name()+".$instance", service.span()));
|
||||
for (var method : service.methods()) appendImportedCallable(importedCallables, importedCallableKeys,
|
||||
new PbsFrontendCompiler.ImportedCallableSurface(parsedSource.moduleId(), service.name()+"."+method.name(),
|
||||
method.parameters().size(),returnSlotsFor(method),method.returnKind(),method.returnType(),
|
||||
frontendCompiler.callableShapeSurfaceOf(method),service.name()+"."+method.name(), service.span()));
|
||||
}
|
||||
}
|
||||
if (declaration instanceof PbsAst.ImplementsDecl implementation) {
|
||||
boolean ownerVisible = parsedSource.ast().topDecls().stream().anyMatch(d -> implementation.ownerName().equals(topDeclName(d)))
|
||||
|| sourcesByModule.get(parsedSource.moduleId()).stream().flatMap(source -> source.ast().topDecls().stream())
|
||||
.anyMatch(d -> implementation.ownerName().equals(topDeclName(d))
|
||||
&& siblingDeclarationsByModule.getOrDefault(parsedSource.moduleId(),Set.of()).contains(d.span()));
|
||||
if (ownerVisible) {
|
||||
appendSupplementalTopDecl(implementation, supplementalTopDecls, supplementalKeys);
|
||||
appendTypeDependencyDecls(implementation, topDeclsByNameByModule.get(parsedSource.moduleId()), supplementalTopDecls, supplementalKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +156,7 @@ final class PbsImportedSemanticContextService {
|
||||
var accessor = p.studio.compiler.pbs.lowering.PbsExecutableCallableRegistryFactory.singletonAccessor(serviceDecl);
|
||||
appendImportedCallable(importedCallables, importedCallableKeys,
|
||||
new PbsFrontendCompiler.ImportedCallableSurface(importedModuleId, localName+".$instance", 0, 1,
|
||||
accessor.returnKind(), accessor.returnType(), frontendCompiler.callableShapeSurfaceOf(accessor), serviceDecl.name()+".$instance"));
|
||||
accessor.returnKind(), accessor.returnType(), frontendCompiler.callableShapeSurfaceOf(accessor), serviceDecl.name()+".$instance", serviceDecl.span()));
|
||||
for (final var method : serviceDecl.methods()) {
|
||||
appendImportedCallable(
|
||||
importedCallables,
|
||||
@@ -137,7 +168,7 @@ final class PbsImportedSemanticContextService {
|
||||
returnSlotsFor(method),
|
||||
method.returnKind(),
|
||||
method.returnType(),
|
||||
frontendCompiler.callableShapeSurfaceOf(method), serviceDecl.name() + "." + method.name()));
|
||||
frontendCompiler.callableShapeSurfaceOf(method), serviceDecl.name() + "." + method.name(), serviceDecl.span()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -151,7 +182,7 @@ final class PbsImportedSemanticContextService {
|
||||
appendImportedCallable(importedCallables, importedCallableKeys,
|
||||
new PbsFrontendCompiler.ImportedCallableSurface(importedModuleId,localName+"."+method.name(),
|
||||
executable.parameters().size(),returnSlotsFor(executable),executable.returnKind(),executable.returnType(),
|
||||
frontendCompiler.callableShapeSurfaceOf(executable), structDecl.name()+"."+method.name()));
|
||||
frontendCompiler.callableShapeSurfaceOf(executable), structDecl.name()+"."+method.name(), structDecl.span()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -249,7 +280,7 @@ final class PbsImportedSemanticContextService {
|
||||
var executable=p.studio.compiler.pbs.lowering.PbsExecutableCallableRegistryFactory.withReceiver(method,struct.name(),"this");
|
||||
appendImportedCallable(callables,callableKeys,new PbsFrontendCompiler.ImportedCallableSurface(definingModule,local+"."+method.name(),
|
||||
executable.parameters().size(),returnSlotsFor(executable),executable.returnKind(),executable.returnType(),
|
||||
frontendCompiler.callableShapeSurfaceOf(executable),struct.name()+"."+method.name()));
|
||||
frontendCompiler.callableShapeSurfaceOf(executable),struct.name()+"."+method.name(), struct.span()));
|
||||
}
|
||||
for(var provider:sourcesByModule.getOrDefault(definingModule,new ArrayList<>()))for(var member:provider.ast().topDecls())
|
||||
if(member instanceof PbsAst.ImplementsDecl implementation&&implementation.ownerName().equals(struct.name())) {
|
||||
|
||||
+3
-1
@@ -18,8 +18,10 @@ record PbsModuleAssembly(
|
||||
ReadOnlyList<ModuleReference> canonicalModulePool,
|
||||
Set<ModuleId> failedModuleIds,
|
||||
ModuleTable moduleTable,
|
||||
Map<ModuleId, Map<String, IRGlobalVisibility>> globalVisibilityByModule) {
|
||||
Map<ModuleId, Map<String, IRGlobalVisibility>> globalVisibilityByModule,
|
||||
Map<ModuleId, Set<p.studio.compiler.source.Span>> siblingDeclarationsByModule) {
|
||||
PbsModuleAssembly {
|
||||
siblingDeclarationsByModule = Map.copyOf(siblingDeclarationsByModule);
|
||||
parsedSourceFiles = parsedSourceFiles == null ? ReadOnlyList.empty() : parsedSourceFiles;
|
||||
canonicalModulePool = canonicalModulePool == null ? ReadOnlyList.empty() : canonicalModulePool;
|
||||
failedModuleIds = failedModuleIds == null ? Set.of() : Set.copyOf(failedModuleIds);
|
||||
|
||||
+3
-1
@@ -118,13 +118,15 @@ final class PbsModuleAssemblyService {
|
||||
moduleVisibilityValidator.validate(ReadOnlyList.wrap(modules), nameTable, diagnostics);
|
||||
markModulesWithLinkingErrors(diagnostics, moduleIdByFile, failedModuleIds);
|
||||
|
||||
var siblingDeclarations = new LinkedHashMap<ModuleId, Set<Span>>();
|
||||
for (var module : modules) siblingDeclarations.put(moduleId(moduleTable, module.coordinates()), moduleVisibilityValidator.siblingDeclarations(module, nameTable));
|
||||
return new PbsModuleAssembly(
|
||||
ReadOnlyList.wrap(parsedSourceFiles),
|
||||
buildModuleDependencyGraph(parsedSourceFiles, moduleTable),
|
||||
emitModulePool(moduleTable),
|
||||
failedModuleIds,
|
||||
moduleTable,
|
||||
collectGlobalVisibilityByModule(modulesByCoordinates, moduleTable));
|
||||
collectGlobalVisibilityByModule(modulesByCoordinates, moduleTable), siblingDeclarations);
|
||||
}
|
||||
|
||||
private Map<ModuleId, Map<String, IRGlobalVisibility>> collectGlobalVisibilityByModule(
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package p.studio.compiler.pbs;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.compiler.pbs.ast.PbsAst;
|
||||
import p.studio.compiler.source.Span;
|
||||
import p.studio.compiler.source.identifiers.FileId;
|
||||
import p.studio.compiler.source.diagnostics.*;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
import java.util.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class GenericDiagnosticContextTest {
|
||||
@Test void specializationWrapperPreservesDetectorAndReportedPhase() {
|
||||
var span = new Span(new FileId(0), 0, 4);
|
||||
var declaration = new PbsAst.HostDecl("Fixture", ReadOnlyList.empty(), ReadOnlyList.empty(), span);
|
||||
var application = new PbsAst.ApplicationOrigin(declaration, ReadOnlyList.empty(), "fixture", "Fixture<int>", span);
|
||||
var original = DiagnosticDescriptions.attach(new Diagnostic(Severity.Error, "E_SEM_UNSUPPORTED_LOWERING", "failed", span, List.of()),
|
||||
"pbs.lowering.call-resolution", Map.of("requestedSymbol", "probe", "argumentCount", 0), FailureKind.PROGRAM_REJECTION);
|
||||
var sink = DiagnosticSink.empty(); PbsGenericDiagnostics.forOrigin(application, sink).report(original);
|
||||
var output = sink.asCollection().iterator().next();
|
||||
assertEquals(original.getContext(), output.getContext()); assertEquals(original.getReportedPhase(), output.getReportedPhase());
|
||||
assertEquals(original.getCode(), output.getCode()); assertEquals(2, output.getRelated().size());
|
||||
assertTrue(output.getMessage().contains("Fixture<int>"));
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package p.studio.compiler.pbs.lowering;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.models.*;
|
||||
import p.studio.compiler.messages.FrontendPhaseContext;
|
||||
import p.studio.compiler.services.PBSFrontendPhaseService;
|
||||
import p.studio.compiler.pbs.ast.PbsAst;
|
||||
import p.studio.compiler.pbs.lexer.PbsLexer;
|
||||
import p.studio.compiler.pbs.parser.PbsParser;
|
||||
import p.studio.compiler.source.Span;
|
||||
import p.studio.compiler.source.tables.*;
|
||||
import p.studio.compiler.source.diagnostics.DiagnosticSink;
|
||||
import p.studio.compiler.utilities.SourceProviderFactory;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class PbsNominalOwnerRegressionTest {
|
||||
@TempDir Path temporary;
|
||||
@Test void declarationScopeAndSyntheticReceiverHaveDistinctResolutionEvidence() throws Exception {
|
||||
var json=new ObjectMapper();var reports=new ArrayList<Map<String,Object>>();
|
||||
var cases=json.readTree(getClass().getResourceAsStream("/production-regressions/cases.json")).path("cases");
|
||||
for(var example:cases) {
|
||||
String id=example.path("id").asText();
|
||||
if(!Set.of("F4-distinct","F4-same-no-dependency","F4-same-dependency","F4-rename-a").contains(id))continue;
|
||||
var root=Files.createDirectory(temporary.resolve(id)).toRealPath();var projects=new ProjectTable();var files=new FileTable(1);
|
||||
var project=projects.register(ProjectDescriptor.builder().rootPath(root).name("caseapp").version("1").sourceRoots(ReadOnlyList.from(root.resolve("src"))).build());
|
||||
var entries=example.path("files").fields();p.studio.compiler.source.identifiers.FileId main=null;
|
||||
while(entries.hasNext()) {
|
||||
var entry=entries.next();var path=root.resolve(entry.getKey());Files.createDirectories(path.getParent());Files.writeString(path,entry.getValue().asText());
|
||||
if(entry.getKey().endsWith(".pbs")||entry.getKey().endsWith(".barrel")) {
|
||||
var file=files.register(new SourceHandle(project,root.relativize(path),path,Files.size(path),0,SourceProviderFactory.filesystem()));
|
||||
if(entry.getKey().equals("src/a/main.pbs"))main=file;
|
||||
}
|
||||
}
|
||||
assertNotNull(main);
|
||||
var context=new FrontendPhaseContext(projects,files,new BuildStack(ReadOnlyList.from(project)),1,AppMode.Game);
|
||||
var supplemental=PBSFrontendPhaseService.importedSupplementalTopDeclsByFile(context,DiagnosticSink.empty(),p.studio.compiler.messages.BuildingIssueSink.empty()).get(main);
|
||||
var diagnostics=DiagnosticSink.empty();var ast=PbsParser.parse(PbsLexer.lex(files.get(main).readUtf8().orElseThrow(),main,diagnostics),main,diagnostics);
|
||||
var types=new PbsRuntimeTypes(ast,supplemental,Map.of());
|
||||
var global=(PbsAst.GlobalDecl)ast.topDecls().stream().filter(d->d instanceof PbsAst.GlobalDecl).findFirst().orElseThrow();
|
||||
var declaration=types.contractTypes.declaration(global.explicitType());assertNotNull(declaration);
|
||||
var flattened=types.structs.get(global.explicitType().name());assertNotNull(flattened);
|
||||
assertEquals(declaration.span(), types.struct(global.explicitType()).span());
|
||||
assertEquals(types.key(global.explicitType()), types.key(PbsRuntimeTypes.type(global.explicitType().name())));
|
||||
reports.add(Map.of("case",id,"source",root.relativize(files.get(declaration.span().getFileId()).getCanonPath()).toString(),
|
||||
"flatOwnerSource",root.relativize(files.get(flattened.span().getFileId()).getCanonPath()).toString(),
|
||||
"declaredReceiverKey",types.key(global.explicitType()),"syntheticReceiverKey",types.key(PbsRuntimeTypes.type(global.explicitType().name())),
|
||||
"flatOwnerMatches",declaration.span().equals(flattened.span())));
|
||||
}
|
||||
var directory=Path.of("build/production-regressions");Files.createDirectories(directory);
|
||||
json.writerWithDefaultPrettyPrinter().writeValue(Files.createTempFile(directory,"nominal-trace-",".json").toFile(),reports);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import p.studio.AppMode;
|
||||
import p.studio.compiler.messages.*;
|
||||
import p.studio.compiler.models.*;
|
||||
import p.studio.compiler.source.tables.*;
|
||||
import p.studio.compiler.utilities.SourceProviderFactory;
|
||||
import p.studio.compiler.source.diagnostics.*;
|
||||
import p.studio.utilities.logs.LogAggregator;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class PbsProductionLoweringRegressionTest {
|
||||
@TempDir Path root;
|
||||
static Stream<String> cases() throws Exception {
|
||||
try(var input=PbsProductionLoweringRegressionTest.class.getResourceAsStream("/production-regressions/cases.json")) {
|
||||
byte[] corpus=input.readAllBytes();
|
||||
assertEquals("0ad291942af21e990f5cae3348a5be368dee865aa2843ba0d0effd1a9136cb87",
|
||||
HexFormat.of().formatHex(java.security.MessageDigest.getInstance("SHA-256").digest(corpus)));
|
||||
return new ObjectMapper().readTree(corpus).path("cases").findValuesAsText("id").stream();
|
||||
}
|
||||
}
|
||||
@ParameterizedTest(name="{0}") @MethodSource("cases")
|
||||
void originalCorpusKeepsSourceAndExpectedFrontendResult(String id) throws Exception {
|
||||
var corpus=new ObjectMapper().readTree(getClass().getResourceAsStream("/production-regressions/cases.json"));
|
||||
JsonNode example=null; for(var c:corpus.path("cases"))if(c.path("id").asText().equals(id))example=c;
|
||||
assertNotNull(example); checkCase(example);
|
||||
}
|
||||
static Stream<String> focusedCases() throws Exception {
|
||||
return new ObjectMapper().readTree(PbsProductionLoweringRegressionTest.class.getResourceAsStream("/production-regressions/focused-cases.json")).path("cases").findValuesAsText("id").stream();
|
||||
}
|
||||
@ParameterizedTest(name="{0}") @MethodSource("focusedCases")
|
||||
void focusedContextVisibilityAndSharedIdentity(String id) throws Exception {
|
||||
var examples=new ObjectMapper().readTree(getClass().getResourceAsStream("/production-regressions/focused-cases.json")).path("cases");
|
||||
for(var example:examples)if(example.path("id").asText().equals(id)){checkCase(example);return;}
|
||||
fail("Unknown focused case "+id);
|
||||
}
|
||||
void checkCase(JsonNode example) throws Exception {
|
||||
var id=example.path("id").asText(); var files=new LinkedHashMap<String,String>();
|
||||
var entries=example.path("files").fields();while(entries.hasNext()){var entry=entries.next();files.put(entry.getKey(),entry.getValue().asText());}
|
||||
var result=compile(files);
|
||||
assertEquals(example.path("expectedCompile").asText().equals("rejected"),result.diagnostics().hasErrors(),id+": "+result.diagnostics().asCollection());
|
||||
if(id.equals("F3-global"))assertEquals(1,result.backend().getGlobals().stream().filter(g->g.name().equals("count")).count());
|
||||
for(var entry:files.entrySet())assertEquals(entry.getValue(),Files.readString(root.resolve(entry.getKey())));
|
||||
}
|
||||
@Test void expectedReturnOverloadsRemainContextual() throws Exception {
|
||||
var result=compile(Map.of("src/mod.barrel","pub fn frame() -> void;\n", "src/main.pbs", """
|
||||
declare struct Probe() { fn value() -> int { return 1; } fn value() -> bool { return true; } }
|
||||
declare global data: Probe = new Probe();
|
||||
fn check() -> bool { return data.value(); }
|
||||
[Frame] fn frame() -> void { let number: int=data.value(); let flag: bool=data.value(); if !check() || !flag || number!=1 { let failure=1/0; } }
|
||||
"""));
|
||||
assertFalse(result.diagnostics().hasErrors(), result.diagnostics().asCollection().toString());
|
||||
}
|
||||
record Compiled(IRBackend backend, DiagnosticSink diagnostics) {}
|
||||
Compiled compile(Map<String,String> sources) throws Exception {
|
||||
root=root.toRealPath(); var projects=new ProjectTable();var files=new FileTable(1);
|
||||
var owner=projects.register(ProjectDescriptor.builder().rootPath(root).name("caseapp").version("1.0.0")
|
||||
.sourceRoots(ReadOnlyList.from(root.resolve("src"))).build());
|
||||
for(var entry:sources.entrySet()) {
|
||||
var path=root.resolve(entry.getKey());Files.createDirectories(path.getParent());Files.writeString(path,entry.getValue());
|
||||
if(entry.getKey().endsWith(".pbs")||entry.getKey().endsWith(".barrel"))files.register(new SourceHandle(owner,root.relativize(path),path,Files.size(path),0,SourceProviderFactory.filesystem()));
|
||||
}
|
||||
var diagnostics=DiagnosticSink.empty(); var backend=new PBSFrontendPhaseService().compile(
|
||||
new FrontendPhaseContext(projects,files,new BuildStack(ReadOnlyList.from(owner)),1,AppMode.Game),diagnostics,LogAggregator.empty(),BuildingIssueSink.empty());
|
||||
return new Compiled(backend,diagnostics);
|
||||
}
|
||||
}
|
||||
+451
@@ -0,0 +1,451 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"cases": [
|
||||
{
|
||||
"id": "F1-local",
|
||||
"family": "call-comparison-return",
|
||||
"description": "Control: method result materialized before comparison",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare struct Probe() { fn value() -> int { return 1; } }\ndeclare global data: Probe = new Probe();\nfn check() -> bool { let value=data.value(); return value!=0; }\n[Frame] fn frame() -> void { if !check() { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "35df5a71b9d508b20e8b293a769ba1397a3209d99246c39240e8788cda932990"
|
||||
},
|
||||
{
|
||||
"id": "F1-direct",
|
||||
"family": "call-comparison-return",
|
||||
"description": "Method call compared directly in returned expression",
|
||||
"control": "F1-local",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare struct Probe() { fn value() -> int { return 1; } }\ndeclare global data: Probe = new Probe();\nfn check() -> bool { return data.value()!=0; }\n[Frame] fn frame() -> void { if !check() { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "382223b4c520762a93e3ee767255175adec8b24f69949b335c1a0030c9d75e61"
|
||||
},
|
||||
{
|
||||
"id": "F1-two-calls",
|
||||
"family": "call-comparison-return",
|
||||
"description": "Two method calls as comparison operands",
|
||||
"control": "F1-local",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare struct Probe() { fn value() -> int { return 1; } }\ndeclare global data: Probe = new Probe();\nfn check() -> bool { return data.value()==data.value(); }\n[Frame] fn frame() -> void { if !check() { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "2e3da1c805c18b5cdc34ca372fae737804a9274205ef377ac21d5b0034d60c4f"
|
||||
},
|
||||
{
|
||||
"id": "F1-service-this",
|
||||
"family": "call-comparison-return",
|
||||
"description": "Service receiver this inside a returned comparison",
|
||||
"control": "F1-service-local",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare service Probe { fn value() -> int { return 1; } fn check() -> bool { return this.value()!=0; } }\n[Frame] fn frame() -> void { if !Probe.check() { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "78a7ba39a880d9136b49f82ecbee7d409333c26861ff0a6b429ae6a55f08d089"
|
||||
},
|
||||
{
|
||||
"id": "F1-service-local",
|
||||
"family": "call-comparison-return",
|
||||
"description": "Control: identical service call materialized before returned comparison",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare service Probe { fn value() -> int { return 1; } fn check() -> bool { let value=this.value(); return value!=0; } }\n[Frame] fn frame() -> void { if !Probe.check() { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "f07038dc6f42923a65b1df8c4d17aa61eb1714ae7907d82b87fcda9e6c4b73fb"
|
||||
},
|
||||
{
|
||||
"id": "F1-condition",
|
||||
"family": "call-comparison-return",
|
||||
"description": "Control: direct method comparison in an if condition",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare struct Probe() { fn value() -> int { return 1; } }\ndeclare global data: Probe = new Probe();\n[Frame] fn frame() -> void { if data.value()!=1 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "415d08d0155fc8e8b4e0df3c1eb47c0a6aa7bda6481fdc4f5024c14d0f70d014"
|
||||
},
|
||||
{
|
||||
"id": "F2-locals",
|
||||
"family": "nested-call-expression",
|
||||
"description": "Control: effectful call arguments stored in locals",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare global calls: int=0;\nfn next() -> int { calls+=1; return calls; }\nfn add(a: int,b: int) -> int { return a+b; }\n[Frame] fn frame() -> void { calls=0; let a=next(); let b=next(); let value=add(a,b); if value!=3 || calls!=2 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "1eb4dbd0bfa6fbc9e002793e6c23eefa80eb091d40ccf2253520b532b3420218"
|
||||
},
|
||||
{
|
||||
"id": "F2-arguments",
|
||||
"family": "nested-call-expression",
|
||||
"description": "Effectful call arguments evaluate once, left to right",
|
||||
"control": "F2-locals",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare global calls: int=0;\nfn next() -> int { calls+=1; return calls; }\nfn add(a: int,b: int) -> int { return a+b; }\n[Frame] fn frame() -> void { calls=0; let value=add(next(),next()); if value!=3 || calls!=2 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "b8713121ffe7afacdd9d4ad6046768ff4ad681b44fcc153f84a432f6df75717c"
|
||||
},
|
||||
{
|
||||
"id": "F2-expression",
|
||||
"family": "nested-call-expression",
|
||||
"description": "Effectful calls nested inside arithmetic argument",
|
||||
"control": "F2-locals",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare global calls: int=0;\nfn next() -> int { calls+=1; return calls; }\nfn add(a: int,b: int) -> int { return a+b; }\n[Frame] fn frame() -> void { calls=0; let value=add(next()+next(),next()); if value!=6 || calls!=3 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "c6ede06ecfad7bdd167b8f3afb849df362787484db1968f74b62c24909818073"
|
||||
},
|
||||
{
|
||||
"id": "F2-struct-method",
|
||||
"family": "nested-call-expression",
|
||||
"description": "Struct method used as another method argument",
|
||||
"control": "F2-locals",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare struct Probe() { fn value() -> int { return 1; } }\ndeclare global data: Probe = new Probe();\nfn add(a: int,b: int) -> int { return a+b; }\n[Frame] fn frame() -> void { let value=add(data.value(),data.value()); if value!=2 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "8ed2b002ef5c20f01ae09949dc0ae75c574cce782dbe27bd304b25fa94045894"
|
||||
},
|
||||
{
|
||||
"id": "F3-single-file",
|
||||
"family": "same-module-files",
|
||||
"description": "Control: function and caller in the same file",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "fn increment(value: int) -> int { return value+1; }\n[Frame] fn frame() -> void { let value=increment(2); if value!=3 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "aff9dbc6f5e3b67b713da29e7e20eb97913464bedcc5f858964ec110ed7b8c4a"
|
||||
},
|
||||
{
|
||||
"id": "F3-function",
|
||||
"family": "same-module-files",
|
||||
"description": "mod function called from another file",
|
||||
"control": "F3-single-file",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\nmod fn increment(value: int) -> int;\n",
|
||||
"src/helpers.pbs": "fn increment(value: int) -> int { return value+1; }\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { let value=increment(2); if value!=3 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "bcf9162dd44b7b7a50428e368789d10ab929301f382bae7c35cab06f1595c4b1"
|
||||
},
|
||||
{
|
||||
"id": "F3-global",
|
||||
"family": "same-module-files",
|
||||
"description": "mod global mutated from another file",
|
||||
"control": "F3-global-local",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\nmod global count;\n",
|
||||
"src/state.pbs": "declare global count: int=0;\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { count=4; if count!=4 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "89c0749385172457659ca2e337ebc368e349065626a815198c314a089d95fc34"
|
||||
},
|
||||
{
|
||||
"id": "F3-service",
|
||||
"family": "same-module-files",
|
||||
"description": "mod service called from another file",
|
||||
"control": "F3-service-local",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\nmod service Helper;\n",
|
||||
"src/helpers.pbs": "declare service Helper { fn value() -> int { return 3; } }\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { let value=Helper.value(); if value!=3 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "37b6c3b4c7d94d1f6f1cc258c84791fdd32c20ea38a88940b735fccf1c7f3b22"
|
||||
},
|
||||
{
|
||||
"id": "F3-global-local",
|
||||
"family": "same-module-files",
|
||||
"description": "Control: identical global and caller in the same file",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare global count: int=0;\n[Frame] fn frame() -> void { count=4; if count!=4 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "e175339cc069d0e14deb8e4e098b1310d877851f2415991ad65b446563aea924"
|
||||
},
|
||||
{
|
||||
"id": "F3-service-local",
|
||||
"family": "same-module-files",
|
||||
"description": "Control: identical service and caller in the same file",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare service Helper { fn value() -> int { return 3; } }\n[Frame] fn frame() -> void { let value=Helper.value(); if value!=3 { let failure=1/0; } }\n"
|
||||
},
|
||||
"sourceSha256": "387e15a0de25644a8862b6f88b74fc7839795e10c8736ebc5ada31670ffd79cb"
|
||||
},
|
||||
{
|
||||
"id": "F3-file-private",
|
||||
"family": "same-module-files",
|
||||
"description": "Negative control: function absent from barrel stays file-private",
|
||||
"control": "F3-function",
|
||||
"expectedCompile": "rejected",
|
||||
"expectedRuntime": "not_run",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/helpers.pbs": "fn increment(value: int) -> int { return value+1; }\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { let value=increment(2); }\n"
|
||||
},
|
||||
"sourceSha256": "b9359695e141c6fd14d5fbfcab68a8829ef4d87c3c7408dbc366465184ec2cfb"
|
||||
},
|
||||
{
|
||||
"id": "F4-distinct",
|
||||
"family": "homonymous-types",
|
||||
"description": "Types ARoomData/BRoomData; dependency=True; direct=False",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { A } from @caseapp:a;\nimport { B } from @caseapp:b;\n[Frame] fn frame() -> void { let value=A.value(); if value!=3 { let failure=1/0; } let other=B.value(); if other!=2 { let failure=1/0; } }\n",
|
||||
"src/a/mod.barrel": "pub service A;\nmod struct ARoomData;\n",
|
||||
"src/a/data.pbs": "declare struct ARoomData() { fn value() -> int { return 1; } }\n",
|
||||
"src/a/main.pbs": "import { B } from @caseapp:b;\ndeclare global room: ARoomData = new ARoomData();\ndeclare service A { fn value() -> int { let own=room.value(); let other=B.value(); return own+other; } }\n",
|
||||
"src/b/mod.barrel": "pub service B;\nmod struct BRoomData;\n",
|
||||
"src/b/data.pbs": "declare struct BRoomData() { fn value() -> int { return 2; } }\n",
|
||||
"src/b/main.pbs": "declare global room: BRoomData = new BRoomData();\ndeclare service B { fn value() -> int { return room.value(); } }\n"
|
||||
},
|
||||
"sourceSha256": "99c527e7749e4ea7c1cecce4063467e4f411b5481cdd641186975fee42299811"
|
||||
},
|
||||
{
|
||||
"id": "F4-same-no-dependency",
|
||||
"family": "homonymous-types",
|
||||
"description": "Types RoomData/RoomData; dependency=False; direct=False",
|
||||
"control": "F4-distinct",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { A } from @caseapp:a;\nimport { B } from @caseapp:b;\n[Frame] fn frame() -> void { let value=A.value(); if value!=1 { let failure=1/0; } let other=B.value(); if other!=2 { let failure=1/0; } }\n",
|
||||
"src/a/mod.barrel": "pub service A;\nmod struct RoomData;\n",
|
||||
"src/a/data.pbs": "declare struct RoomData() { fn value() -> int { return 1; } }\n",
|
||||
"src/a/main.pbs": "declare global room: RoomData = new RoomData();\ndeclare service A { fn value() -> int { let own=room.value(); return own; } }\n",
|
||||
"src/b/mod.barrel": "pub service B;\nmod struct RoomData;\n",
|
||||
"src/b/data.pbs": "declare struct RoomData() { fn value() -> int { return 2; } }\n",
|
||||
"src/b/main.pbs": "declare global room: RoomData = new RoomData();\ndeclare service B { fn value() -> int { return room.value(); } }\n"
|
||||
},
|
||||
"sourceSha256": "db3c59d1f4f618856ed554310e5774f60d64f70e9ed0b122a5ab57d4e9870ce5"
|
||||
},
|
||||
{
|
||||
"id": "F4-same-dependency",
|
||||
"family": "homonymous-types",
|
||||
"description": "Types RoomData/RoomData; dependency=True; direct=False",
|
||||
"control": "F4-distinct",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { A } from @caseapp:a;\nimport { B } from @caseapp:b;\n[Frame] fn frame() -> void { let value=A.value(); if value!=3 { let failure=1/0; } let other=B.value(); if other!=2 { let failure=1/0; } }\n",
|
||||
"src/a/mod.barrel": "pub service A;\nmod struct RoomData;\n",
|
||||
"src/a/data.pbs": "declare struct RoomData() { fn value() -> int { return 1; } }\n",
|
||||
"src/a/main.pbs": "import { B } from @caseapp:b;\ndeclare global room: RoomData = new RoomData();\ndeclare service A { fn value() -> int { let own=room.value(); let other=B.value(); return own+other; } }\n",
|
||||
"src/b/mod.barrel": "pub service B;\nmod struct RoomData;\n",
|
||||
"src/b/data.pbs": "declare struct RoomData() { fn value() -> int { return 2; } }\n",
|
||||
"src/b/main.pbs": "declare global room: RoomData = new RoomData();\ndeclare service B { fn value() -> int { return room.value(); } }\n"
|
||||
},
|
||||
"sourceSha256": "c4c624cb3556b8d05927ceda69e596482f4ec1d7b82f7f4ca7442483e2b8b831"
|
||||
},
|
||||
{
|
||||
"id": "F4-rename-a",
|
||||
"family": "homonymous-types",
|
||||
"description": "Types StartRoomData/RoomData; dependency=True; direct=False",
|
||||
"control": "F4-distinct",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { A } from @caseapp:a;\nimport { B } from @caseapp:b;\n[Frame] fn frame() -> void { let value=A.value(); if value!=3 { let failure=1/0; } let other=B.value(); if other!=2 { let failure=1/0; } }\n",
|
||||
"src/a/mod.barrel": "pub service A;\nmod struct StartRoomData;\n",
|
||||
"src/a/data.pbs": "declare struct StartRoomData() { fn value() -> int { return 1; } }\n",
|
||||
"src/a/main.pbs": "import { B } from @caseapp:b;\ndeclare global room: StartRoomData = new StartRoomData();\ndeclare service A { fn value() -> int { let own=room.value(); let other=B.value(); return own+other; } }\n",
|
||||
"src/b/mod.barrel": "pub service B;\nmod struct RoomData;\n",
|
||||
"src/b/data.pbs": "declare struct RoomData() { fn value() -> int { return 2; } }\n",
|
||||
"src/b/main.pbs": "declare global room: RoomData = new RoomData();\ndeclare service B { fn value() -> int { return room.value(); } }\n"
|
||||
},
|
||||
"sourceSha256": "6cab04b1fbc3724cec1670a11ab46a792e5b83ea1fb12b4bf80f98d178c1290e"
|
||||
},
|
||||
{
|
||||
"id": "F4-same-direct",
|
||||
"family": "homonymous-types",
|
||||
"description": "Types RoomData/RoomData; dependency=True; direct=True",
|
||||
"control": "F4-distinct",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { A } from @caseapp:a;\nimport { B } from @caseapp:b;\n[Frame] fn frame() -> void { let value=A.value(); if value!=3 { let failure=1/0; } let other=B.value(); if other!=2 { let failure=1/0; } }\n",
|
||||
"src/a/mod.barrel": "pub service A;\nmod struct RoomData;\n",
|
||||
"src/a/data.pbs": "declare struct RoomData() { fn value() -> int { return 1; } }\n",
|
||||
"src/a/main.pbs": "import { B } from @caseapp:b;\ndeclare global room: RoomData = new RoomData();\ndeclare service A { fn value() -> int { return room.value()+B.value(); } }\n",
|
||||
"src/b/mod.barrel": "pub service B;\nmod struct RoomData;\n",
|
||||
"src/b/data.pbs": "declare struct RoomData() { fn value() -> int { return 2; } }\n",
|
||||
"src/b/main.pbs": "declare global room: RoomData = new RoomData();\ndeclare service B { fn value() -> int { return room.value(); } }\n"
|
||||
},
|
||||
"sourceSha256": "79fc0901e3e60e7b50b83f5d10ba4e548bd57b0c83d281def25369cadb74633e"
|
||||
},
|
||||
{
|
||||
"id": "F4-public-aliases",
|
||||
"family": "homonymous-types",
|
||||
"description": "Two distinct nominal RoomData declarations imported with aliases",
|
||||
"control": "F4-distinct",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { RoomData as LeftData } from @caseapp:a;\nimport { RoomData as RightData } from @caseapp:b;\ndeclare global left: LeftData = new LeftData(1);\ndeclare global right: RightData = new RightData(2);\n[Frame] fn frame() -> void { let a=left.value(); let b=right.value(); if a!=1 || b!=2 { let failure=1/0; } }\n",
|
||||
"src/a/mod.barrel": "pub struct RoomData;\n",
|
||||
"src/a/main.pbs": "declare struct RoomData(number: int) { fn value() -> int { return this.number; } }\n",
|
||||
"src/b/mod.barrel": "pub struct RoomData;\n",
|
||||
"src/b/main.pbs": "declare struct RoomData(number: int) { fn value() -> int { return this.number; } }\n"
|
||||
},
|
||||
"sourceSha256": "9379bc7c71cd6c1ff287f5771a78590a2e25b8dead05e78c563ff25ee8d1c207"
|
||||
},
|
||||
{
|
||||
"id": "F5-shopvisit",
|
||||
"family": "imported-struct-construction",
|
||||
"description": "Imported ShopVisit, alias=None, positional=False",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { ShopVisit } from @caseapp:scene;\nimport { Link } from @caseapp:link;\ndeclare global scene: ShopVisit = new ShopVisit.make(10);\n[Frame] fn frame() -> void { let value=Link.read(scene); if value!=10 { let failure=1/0; } }\n",
|
||||
"src/scene/mod.barrel": "pub struct ShopVisit;\n",
|
||||
"src/scene/main.pbs": "declare struct ShopVisit(value: int) { ctor make(value: int) { this.value=value; } fn read() -> int { return this.value; } }\n",
|
||||
"src/link/mod.barrel": "pub service Link;\n",
|
||||
"src/link/main.pbs": "import { ShopVisit } from @caseapp:scene;\ndeclare service Link { fn read(scene: ShopVisit) -> int { return scene.read(); } }\n"
|
||||
},
|
||||
"sourceSha256": "5373eaa6bece79658cb4cbd74fecc47d7d2a5954eee1812576243155fecb4c38"
|
||||
},
|
||||
{
|
||||
"id": "F5-scene",
|
||||
"family": "imported-struct-construction",
|
||||
"description": "Imported Scene, alias=None, positional=False",
|
||||
"control": "F5-shopvisit",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { Scene } from @caseapp:scene;\nimport { Link } from @caseapp:link;\ndeclare global scene: Scene = new Scene.make(10);\n[Frame] fn frame() -> void { let value=Link.read(scene); if value!=10 { let failure=1/0; } }\n",
|
||||
"src/scene/mod.barrel": "pub struct Scene;\n",
|
||||
"src/scene/main.pbs": "declare struct Scene(value: int) { ctor make(value: int) { this.value=value; } fn read() -> int { return this.value; } }\n",
|
||||
"src/link/mod.barrel": "pub service Link;\n",
|
||||
"src/link/main.pbs": "import { Scene } from @caseapp:scene;\ndeclare service Link { fn read(scene: Scene) -> int { return scene.read(); } }\n"
|
||||
},
|
||||
"sourceSha256": "f84b4a4f6eb21100dfff74f26e4f453d4300d3e2dd79d70ee9b3992ed4c8d09f"
|
||||
},
|
||||
{
|
||||
"id": "F5-scene-alias",
|
||||
"family": "imported-struct-construction",
|
||||
"description": "Imported Scene, alias=WorldScene, positional=False",
|
||||
"control": "F5-shopvisit",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { Scene as WorldScene } from @caseapp:scene;\nimport { Link } from @caseapp:link;\ndeclare global scene: WorldScene = new WorldScene.make(10);\n[Frame] fn frame() -> void { let value=Link.read(scene); if value!=10 { let failure=1/0; } }\n",
|
||||
"src/scene/mod.barrel": "pub struct Scene;\n",
|
||||
"src/scene/main.pbs": "declare struct Scene(value: int) { ctor make(value: int) { this.value=value; } fn read() -> int { return this.value; } }\n",
|
||||
"src/link/mod.barrel": "pub service Link;\n",
|
||||
"src/link/main.pbs": "import { Scene } from @caseapp:scene;\ndeclare service Link { fn read(scene: Scene) -> int { return scene.read(); } }\n"
|
||||
},
|
||||
"sourceSha256": "0f53a73f0f969919df0ad0df8a93e5b8e8db552310b69d37cae0f3ff9d625959"
|
||||
},
|
||||
{
|
||||
"id": "F5-scene-positional",
|
||||
"family": "imported-struct-construction",
|
||||
"description": "Imported Scene, alias=None, positional=True",
|
||||
"control": "F5-shopvisit",
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "import { Scene } from @caseapp:scene;\nimport { Link } from @caseapp:link;\ndeclare global scene: Scene = new Scene(10);\n[Frame] fn frame() -> void { let value=Link.read(scene); if value!=10 { let failure=1/0; } }\n",
|
||||
"src/scene/mod.barrel": "pub struct Scene;\n",
|
||||
"src/scene/main.pbs": "declare struct Scene(value: int) { ctor make(value: int) { this.value=value; } fn read() -> int { return this.value; } }\n",
|
||||
"src/link/mod.barrel": "pub service Link;\n",
|
||||
"src/link/main.pbs": "import { Scene } from @caseapp:scene;\ndeclare service Link { fn read(scene: Scene) -> int { return scene.read(); } }\n"
|
||||
},
|
||||
"sourceSha256": "65b3452b0e30037b1e744de8e36dc629f2f5d11f5fb97068566d1a4b38baaeb7"
|
||||
},
|
||||
{
|
||||
"id": "runtime-trap-control",
|
||||
"family": "harness-control",
|
||||
"description": "Deliberate guest fault proves frame assertions are executed",
|
||||
"control": null,
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "fault",
|
||||
"files": {
|
||||
"prometeu.json": "{\n \"name\": \"caseapp\",\n \"version\": \"1.0.0\",\n \"language\": \"pbs\",\n \"stdlib\": \"1\",\n \"target\": \"Game\",\n \"dependencies\": []\n}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { let failure=1/0; }\n"
|
||||
},
|
||||
"sourceSha256": "60013483001b50eb3e7f8a9360142ec5ab49f8ca56edf1d6b0ca5b32251510d9"
|
||||
}
|
||||
]
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"cases": [
|
||||
{
|
||||
"id": "contextual-overloads",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare struct Probe() { fn value() -> int { return 1; } fn value() -> bool { return true; } }\ndeclare global data: Probe = new Probe();\nfn check() -> bool { return data.value(); }\n[Frame] fn frame() -> void { let number: int=data.value(); let flag: bool=data.value(); if !check() || !flag || number!=1 { let failure=1/0; } }\n"
|
||||
},
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"sourceSha256": "c86450c4288ddbe77a90160b93a4d1df6c394fafdbd6de2541f9e3a296eafc07"
|
||||
},
|
||||
{
|
||||
"id": "receiver-argument-order",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/main.pbs": "declare global calls: int=0;\ndeclare struct Probe() { fn read(value: int) -> int { return value; } }\ndeclare global data: Probe=new Probe();\nfn receiver() -> Probe { calls=calls*10+1; return data; }\nfn arg() -> int { calls=calls*10+2; return 3; }\n[Frame] fn frame() -> void { calls=0; let value=receiver().read(arg()); if value!=3 || calls!=12 { let failure=1/0; } }\n"
|
||||
},
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"sourceSha256": "c37878a556424c11771db991be61c589a8243667c5b0c957216f23990ef88ca6"
|
||||
},
|
||||
{
|
||||
"id": "shared-global-storage",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\nmod global count;\nmod fn increment() -> int;\n",
|
||||
"src/state.pbs": "declare global count: int=0;\nfn increment() -> int { count+=1; return count; }\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { count=4; let value=increment(); if value!=5 || count!=5 { let failure=1/0; } }\n"
|
||||
},
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"sourceSha256": "95b641e1371de5bae0339f29bd32d44c81e5861b18ab0d1054e738c958b3ce9f"
|
||||
},
|
||||
{
|
||||
"id": "shared-service-singleton",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\nmod service Counter;\nmod fn instance() -> Counter;\n",
|
||||
"src/state.pbs": "declare service Counter {}\nfn instance() -> Counter { return Counter; }\n",
|
||||
"src/main.pbs": "import { referenceEquals } from @sdk:hash;\n[Frame] fn frame() -> void { if !referenceEquals<Counter>(Counter,instance()) { let failure=1/0; } }\n"
|
||||
},
|
||||
"expectedCompile": "compiled",
|
||||
"expectedRuntime": "passed",
|
||||
"sourceSha256": "e5a21998b2eb8f7e47a5818f59081d080dd332cc36bbb032ddcff07b3335f3d5"
|
||||
},
|
||||
{
|
||||
"id": "private-overload",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\nmod fn helper(value: int) -> int;\n",
|
||||
"src/helper.pbs": "fn helper(value: int) -> int { return value; }\nfn helper(value: bool) -> bool { return value; }\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { let flag=helper(true); }\n"
|
||||
},
|
||||
"expectedCompile": "rejected",
|
||||
"expectedRuntime": "not_run",
|
||||
"sourceSha256": "59d9ab7560f89be231bd82243bcb9114a23c3de2e40b0f02c78669ed56dc917d"
|
||||
},
|
||||
{
|
||||
"id": "private-global",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/state.pbs": "declare global count: int=0;\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { count=4; }\n"
|
||||
},
|
||||
"expectedCompile": "rejected",
|
||||
"expectedRuntime": "not_run",
|
||||
"sourceSha256": "d001a6d5c611d76d3fbf7dd08dcd3391dfe4e69c40b3aa18c69c2fec4c1f8114"
|
||||
},
|
||||
{
|
||||
"id": "private-service",
|
||||
"files": {
|
||||
"prometeu.json": "{\"name\": \"caseapp\", \"version\": \"1.0.0\", \"language\": \"pbs\", \"stdlib\": \"1\", \"target\": \"Game\", \"dependencies\": []}\n",
|
||||
"src/mod.barrel": "pub fn frame() -> void;\n",
|
||||
"src/state.pbs": "declare service Counter { fn value() -> int { return 1; } }\n",
|
||||
"src/main.pbs": "[Frame] fn frame() -> void { let value=Counter.value(); }\n"
|
||||
},
|
||||
"expectedCompile": "rejected",
|
||||
"expectedRuntime": "not_run",
|
||||
"sourceSha256": "1c5386df70cde3889fd16f20fafb7ace636aa32c457a9bea0bef0b35cfc99a07"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user