semantifold 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +1 -0
  2. package/build/src/backends/effects.js +3 -1
  3. package/build/src/backends/php.d.ts.map +1 -1
  4. package/build/src/backends/php.js +56 -3
  5. package/build/src/backends/scalars.js +2 -2
  6. package/build/src/backends/shared.d.ts +2 -1
  7. package/build/src/backends/shared.d.ts.map +1 -1
  8. package/build/src/backends/shared.js +209 -7
  9. package/build/src/backends/writer.d.ts +18 -4
  10. package/build/src/backends/writer.d.ts.map +1 -1
  11. package/build/src/backends/writer.js +40 -4
  12. package/build/src/frontends/java.d.ts +1 -1
  13. package/build/src/frontends/java.d.ts.map +1 -1
  14. package/build/src/frontends/java.js +14 -11
  15. package/build/src/frontends/javascript-typescript.d.ts +1 -1
  16. package/build/src/frontends/javascript-typescript.d.ts.map +1 -1
  17. package/build/src/frontends/javascript-typescript.js +17 -17
  18. package/build/src/frontends/php.d.ts +5 -1
  19. package/build/src/frontends/php.d.ts.map +1 -1
  20. package/build/src/frontends/php.js +159 -31
  21. package/build/src/frontends/ruby.d.ts +1 -1
  22. package/build/src/frontends/ruby.d.ts.map +1 -1
  23. package/build/src/frontends/ruby.js +12 -9
  24. package/build/src/frontends/types.d.ts +9 -2
  25. package/build/src/frontends/types.d.ts.map +1 -1
  26. package/build/src/frontends/types.js +26 -9
  27. package/build/src/language-registry.d.ts.map +1 -1
  28. package/build/src/language-registry.js +14 -6
  29. package/build/src/mapping.d.ts.map +1 -1
  30. package/build/src/mapping.js +4 -2
  31. package/build/src/semantic/effects.d.ts.map +1 -1
  32. package/build/src/semantic/effects.js +3 -1
  33. package/build/src/semantic/provenance.d.ts.map +1 -1
  34. package/build/src/semantic/provenance.js +37 -4
  35. package/build/src/semantic/types.d.ts +140 -9
  36. package/build/src/semantic/types.d.ts.map +1 -1
  37. package/build/src/semantic/types.js +37 -6
  38. package/build/src/semantic/validate.d.ts +31 -2
  39. package/build/src/semantic/validate.d.ts.map +1 -1
  40. package/build/src/semantic/validate.js +346 -27
  41. package/docs/adr-bounded-subtyping.md +180 -0
  42. package/docs/language-support.md +1 -1
  43. package/package.json +1 -1
  44. package/src/backends/effects.js +1 -0
  45. package/src/backends/php.js +56 -2
  46. package/src/backends/scalars.js +1 -1
  47. package/src/backends/shared.js +210 -6
  48. package/src/backends/writer.js +41 -3
  49. package/src/frontends/java.js +13 -10
  50. package/src/frontends/javascript-typescript.js +16 -16
  51. package/src/frontends/php.js +175 -31
  52. package/src/frontends/ruby.js +11 -8
  53. package/src/frontends/types.js +26 -8
  54. package/src/language-registry.js +13 -5
  55. package/src/mapping.js +3 -1
  56. package/src/semantic/effects.js +1 -0
  57. package/src/semantic/provenance.js +34 -3
  58. package/src/semantic/types.js +39 -5
  59. package/src/semantic/validate.js +377 -26
@@ -169,6 +169,7 @@ export function createLanguageRegistry(candidateRecords) {
169
169
  }
170
170
  if (typeof candidate.roundTrip != "boolean") invalidRegistry(`Registry record '${id}' requires a Boolean round-trip declaration.`, id)
171
171
  const featuresCandidate = candidate.features ?? {
172
+ boundedSubtyping: false,
172
173
  closedRecords: false,
173
174
  conditionControlledLoops: false,
174
175
  conditionalExpressions: false,
@@ -185,7 +186,8 @@ export function createLanguageRegistry(candidateRecords) {
185
186
  }
186
187
 
187
188
  if (!isPlainObject(featuresCandidate) ||
188
- Object.keys(featuresCandidate).sort().join(",") != "closedRecords,conditionControlledLoops,conditionalExpressions,effectfulCapabilitiesAndResources,generalFunctionsAndCalls,immutableCollections,optionalValues,orderedListIteration,orderedMapIteration,referenceClasses,stringInterpolation,typeParametersAndGenerics,typedErrors" ||
189
+ Object.keys(featuresCandidate).sort().join(",") != "boundedSubtyping,closedRecords,conditionControlledLoops,conditionalExpressions,effectfulCapabilitiesAndResources,generalFunctionsAndCalls,immutableCollections,optionalValues,orderedListIteration,orderedMapIteration,referenceClasses,stringInterpolation,typeParametersAndGenerics,typedErrors" ||
190
+ typeof featuresCandidate.boundedSubtyping != "boolean" ||
189
191
  typeof featuresCandidate.closedRecords != "boolean" ||
190
192
  typeof featuresCandidate.conditionControlledLoops != "boolean" ||
191
193
  typeof featuresCandidate.conditionalExpressions != "boolean" ||
@@ -196,12 +198,14 @@ export function createLanguageRegistry(candidateRecords) {
196
198
  typeof featuresCandidate.orderedListIteration != "boolean" ||
197
199
  typeof featuresCandidate.orderedMapIteration != "boolean" ||
198
200
  typeof featuresCandidate.referenceClasses != "boolean" ||
201
+ (featuresCandidate.boundedSubtyping && !featuresCandidate.referenceClasses) ||
199
202
  typeof featuresCandidate.stringInterpolation != "boolean" ||
200
203
  typeof featuresCandidate.typedErrors != "boolean" ||
201
204
  typeof featuresCandidate.typeParametersAndGenerics != "boolean") {
202
205
  invalidRegistry(`Registry record '${id}' has an invalid feature declaration.`, id)
203
206
  }
204
207
  const features = deepFreeze(/** @type {import("./semantic/types.js").LanguageFeatureCapabilities} */ ({
208
+ boundedSubtyping: featuresCandidate.boundedSubtyping,
205
209
  closedRecords: featuresCandidate.closedRecords,
206
210
  conditionControlledLoops: featuresCandidate.conditionControlledLoops,
207
211
  conditionalExpressions: featuresCandidate.conditionalExpressions,
@@ -582,6 +586,7 @@ const records = [
582
586
  optionalValues: false,
583
587
  orderedListIteration: false,
584
588
  orderedMapIteration: false,
589
+ boundedSubtyping: false,
585
590
  referenceClasses: false,
586
591
  typedErrors: false,
587
592
  typeParametersAndGenerics: false
@@ -621,6 +626,7 @@ const records = [
621
626
  optionalValues: false,
622
627
  orderedListIteration: false,
623
628
  orderedMapIteration: false,
629
+ boundedSubtyping: false,
624
630
  referenceClasses: false,
625
631
  typedErrors: false,
626
632
  typeParametersAndGenerics: false
@@ -646,6 +652,7 @@ const records = [
646
652
  optionalValues: false,
647
653
  orderedListIteration: false,
648
654
  orderedMapIteration: false,
655
+ boundedSubtyping: false,
649
656
  referenceClasses: false,
650
657
  typedErrors: false,
651
658
  typeParametersAndGenerics: false
@@ -661,7 +668,7 @@ const records = [
661
668
  artifactMultiplicity: "multiple",
662
669
  binaryBackend: generateBrowserWasm,
663
670
  defaultFilename: "program.wasm",
664
- features: {closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
671
+ features: {boundedSubtyping: false, closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
665
672
  id: "wasm",
666
673
  mapping: {binaryRanges: true, richText: true, sourceMapV3: true},
667
674
  mediaType: "application/wasm",
@@ -671,7 +678,7 @@ const records = [
671
678
  acceptance: {stages: ["generate", "compile", "validate", "instantiate", "execute"], toolchains: ["android"]},
672
679
  applicationBackend: generateAndroidApplication,
673
680
  artifactMultiplicity: "multiple",
674
- features: {closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
681
+ features: {boundedSubtyping: false, closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
675
682
  id: "android",
676
683
  mapping: {binaryRanges: true, richText: true, sourceMapV3: true},
677
684
  roundTrip: false
@@ -680,7 +687,7 @@ const records = [
680
687
  acceptance: {stages: ["generate"], toolchains: []},
681
688
  applicationBackend: generateIosApplication,
682
689
  artifactMultiplicity: "multiple",
683
- features: {closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
690
+ features: {boundedSubtyping: false, closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
684
691
  id: "ios",
685
692
  mapping: {binaryRanges: true, richText: true, sourceMapV3: true},
686
693
  roundTrip: false
@@ -689,7 +696,7 @@ const records = [
689
696
  acceptance: {stages: ["generate", "restore", "compile", "validate", "instantiate", "execute"], toolchains: ["flutter", "android"]},
690
697
  applicationBackend: generateFlutterApplication,
691
698
  artifactMultiplicity: "multiple",
692
- features: {closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
699
+ features: {boundedSubtyping: false, closedRecords: false, conditionControlledLoops: false, conditionalExpressions: false, stringInterpolation: false, effectfulCapabilitiesAndResources: false, generalFunctionsAndCalls: false, immutableCollections: false, optionalValues: false, orderedListIteration: false, orderedMapIteration: false, referenceClasses: false, typedErrors: false, typeParametersAndGenerics: false},
693
700
  id: "flutter",
694
701
  mapping: {binaryRanges: true, richText: true, sourceMapV3: true},
695
702
  roundTrip: false
@@ -712,6 +719,7 @@ function language(values) {
712
719
  return {
713
720
  artifactMultiplicity: "single",
714
721
  features: {
722
+ boundedSubtyping: String(values.id) == "php",
715
723
  closedRecords: ["php", "ruby", "javascript", "typescript", "java"].includes(String(values.id)),
716
724
  conditionControlledLoops: ["php", "ruby", "javascript", "typescript", "java"].includes(String(values.id)),
717
725
  conditionalExpressions: ["php", "ruby", "javascript", "typescript", "java"].includes(String(values.id)),
package/src/mapping.js CHANGED
@@ -764,7 +764,7 @@ export function validateMapping(value) {
764
764
  for (const symbol of mapping.symbols) {
765
765
  if (!symbol || typeof symbol != "object" || typeof symbol.id != "string" || symbol.id.length == 0 || symbolIds.has(symbol.id) ||
766
766
  typeof symbol.name != "string" || symbol.name.length == 0 ||
767
- !["capability", "resource", "failure", "operation", "record", "class", "error", "field", "constructor", "method", "function", "typeParameter", "parameter", "local", "iteration", "catch"].includes(symbol.kind) ||
767
+ !["capability", "resource", "failure", "operation", "record", "interface", "interfaceMethod", "class", "error", "field", "constructor", "method", "function", "typeParameter", "parameter", "local", "iteration", "catch"].includes(symbol.kind) ||
768
768
  !nodeIds.has(symbol.declarationNodeId) || !Array.isArray(symbol.references) ||
769
769
  symbol.semanticDeclarationId !== undefined && (typeof symbol.semanticDeclarationId != "string" || !(
770
770
  symbol.kind == "function" && /^(?:[a-z][a-z0-9._-]*#)?function:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
@@ -774,6 +774,8 @@ export function validateMapping(value) {
774
774
  symbol.kind == "field" && /^(?:[a-z][a-z0-9._-]*#)?(?:record|class):[0-9]+:field:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
775
775
  symbol.kind == "constructor" && /^(?:[a-z][a-z0-9._-]*#)?class:[0-9]+:constructor$/u.test(symbol.semanticDeclarationId) ||
776
776
  symbol.kind == "method" && /^(?:[a-z][a-z0-9._-]*#)?class:[0-9]+:method:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
777
+ symbol.kind == "interface" && /^(?:[a-z][a-z0-9._-]*#)?interface:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
778
+ symbol.kind == "interfaceMethod" && /^(?:[a-z][a-z0-9._-]*#)?interface:[0-9]+:method:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
777
779
  symbol.kind == "typeParameter" && /^(?:[a-z][a-z0-9._-]*#)?(?:function|record):[0-9]+:type:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
778
780
  symbol.kind == "capability" && /^(?:module:[0-9]+\/)?capability:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
779
781
  symbol.kind == "resource" && /^(?:module:[0-9]+\/)?capability:[0-9]+\/resource:[0-9]+$/u.test(symbol.semanticDeclarationId) ||
@@ -326,6 +326,7 @@ function typeIdentity(type) {
326
326
  if (type.kind == "RecordType") return {arguments: type.arguments?.map((argument) =>
327
327
  /** @type {import("./types.js").SemanticTypeIdentity} */ (typeIdentity(argument))), declarationId: type.declarationId, kind: type.kind}
328
328
  if (type.kind == "ReferenceType") return {declarationId: type.declarationId, kind: type.kind}
329
+ if (type.kind == "InterfaceType") return {declarationId: type.declarationId, kind: type.kind}
329
330
  return {kind: type.kind, parameterId: type.parameterId}
330
331
  }
331
332
 
@@ -492,6 +492,7 @@ export function semanticEntries(module) {
492
492
  node.imports.forEach((child, index) => visit(child, `/imports/${index}`, location))
493
493
  }
494
494
  ;(node.records ?? []).forEach((child, index) => visit(child, `/records/${index}`, location))
495
+ ;(node.interfaces ?? []).forEach((child, index) => visit(child, `/interfaces/${index}`, location))
495
496
  if (!("sourceFilename" in node) || Reflect.get(node, "stdlibFacade") !== undefined) {
496
497
  ;(node.classes ?? []).forEach((child, index) => visit(child, `/classes/${index}`, location))
497
498
  }
@@ -512,7 +513,14 @@ export function semanticEntries(module) {
512
513
  } else if (node.kind == "EffectOperationDeclaration") {
513
514
  node.parameters.forEach((child, index) => visit(child.type, `${path}/parameters/${index}/type`, location))
514
515
  visit(node.returnType, `${path}/returnType`, location)
516
+ } else if (node.kind == "InterfaceDeclaration") {
517
+ (node.extends ?? []).forEach((child, index) => visit(child, `${path}/extends/${index}`, location))
518
+ node.methods.forEach((child, index) => visit(child, `${path}/methods/${index}`, location))
519
+ } else if (node.kind == "InterfaceMethodDeclaration") {
520
+ node.parameters.forEach((child, index) => visit(child.type, `${path}/parameters/${index}/type`, location))
521
+ visit(node.returnType, `${path}/returnType`, location)
515
522
  } else if (node.kind == "ClassDeclaration") {
523
+ (node.implements ?? []).forEach((child, index) => visit(child, `${path}/implements/${index}`, location))
516
524
  node.fields.forEach((child, index) => visit(child, `${path}/fields/${index}`, location))
517
525
  visit(node.constructor, `${path}/constructor`, location)
518
526
  node.methods.forEach((child, index) => visit(child, `${path}/methods/${index}`, location))
@@ -665,6 +673,10 @@ function resolveSymbols(module, records) {
665
673
  /** @type {Map<string, string>} */
666
674
  const fieldSymbols = new Map()
667
675
  /** @type {Map<string, string>} */
676
+ const interfaceSymbols = new Map()
677
+ /** @type {Map<string, string>} */
678
+ const interfaceMethodSymbols = new Map()
679
+ /** @type {Map<string, string>} */
668
680
  const classSymbols = new Map()
669
681
  /** @type {Map<string, string>} */
670
682
  const constructorSymbols = new Map()
@@ -724,11 +736,29 @@ function resolveSymbols(module, records) {
724
736
  if (declaration.id) errorSymbols.set(declaration.id, symbol)
725
737
  }
726
738
 
739
+ for (const [index, declaration] of (module.interfaces ?? []).entries()) {
740
+ const declarationPath = `/interfaces/${index}`
741
+ const interfaceSymbol = declare(declaration, declaration.name, "interface", declarationPath)
742
+
743
+ if (declaration.id) interfaceSymbols.set(declaration.id, interfaceSymbol)
744
+ for (const [extendsIndex, parent] of (declaration.extends ?? []).entries()) {
745
+ visitType(parent, `${declarationPath}/extends/${extendsIndex}`)
746
+ }
747
+ for (const [methodIndex, method] of declaration.methods.entries()) {
748
+ const symbol = declare(method, method.name, "interfaceMethod", `${declarationPath}/methods/${methodIndex}`)
749
+
750
+ if (method.id) interfaceMethodSymbols.set(method.id, symbol)
751
+ }
752
+ }
753
+
727
754
  for (const [index, declaration] of (module.classes ?? []).entries()) {
728
755
  const declarationPath = `/classes/${index}`
729
756
  const classSymbol = declare(declaration, declaration.name, "class", declarationPath)
730
757
 
731
758
  if (declaration.id) classSymbols.set(declaration.id, classSymbol)
759
+ for (const [implementsIndex, implemented] of (declaration.implements ?? []).entries()) {
760
+ visitType(implemented, `${declarationPath}/implements/${implementsIndex}`)
761
+ }
732
762
  for (const [fieldIndex, field] of declaration.fields.entries()) {
733
763
  const symbol = declare(field, field.name, "field", `${declarationPath}/fields/${fieldIndex}`)
734
764
 
@@ -806,7 +836,7 @@ function resolveSymbols(module, records) {
806
836
 
807
837
  /**
808
838
  * Declares one canonical symbol.
809
- * @param {import("./types.js").EffectCapabilityDeclaration | import("./types.js").EffectResourceDeclaration | import("./types.js").EffectFailureDeclaration | import("./types.js").EffectOperationDeclaration | import("./types.js").RecordDeclaration | import("./types.js").ClassDeclaration | import("./types.js").ErrorDeclaration | import("./types.js").RecordField | import("./types.js").PrivateField | import("./types.js").ConstructorDeclaration | import("./types.js").MethodDeclaration | import("./types.js").FunctionDeclaration | import("./types.js").TypeParameter | import("./types.js").Parameter | import("./types.js").LocalDeclaration | import("./types.js").ValueBinding | import("./types.js").CatchBinding} node - Declaration.
839
+ * @param {import("./types.js").EffectCapabilityDeclaration | import("./types.js").EffectResourceDeclaration | import("./types.js").EffectFailureDeclaration | import("./types.js").EffectOperationDeclaration | import("./types.js").RecordDeclaration | import("./types.js").ClassDeclaration | import("./types.js").InterfaceDeclaration | import("./types.js").InterfaceMethodDeclaration | import("./types.js").ErrorDeclaration | import("./types.js").RecordField | import("./types.js").PrivateField | import("./types.js").ConstructorDeclaration | import("./types.js").MethodDeclaration | import("./types.js").FunctionDeclaration | import("./types.js").TypeParameter | import("./types.js").Parameter | import("./types.js").LocalDeclaration | import("./types.js").ValueBinding | import("./types.js").CatchBinding} node - Declaration.
810
840
  * @param {string} name - Symbol name.
811
841
  * @param {import("./types.js").SemanticSymbolKind} kind - Symbol kind.
812
842
  * @param {string} path - Declaration occurrence path.
@@ -828,7 +858,7 @@ function resolveSymbols(module, records) {
828
858
  location,
829
859
  name,
830
860
  references: [],
831
- ...(["capability", "resource", "failure", "operation", "record", "class", "error", "field", "constructor", "method", "function", "typeParameter"].includes(kind)
861
+ ...(["capability", "resource", "failure", "operation", "record", "interface", "interfaceMethod", "class", "error", "field", "constructor", "method", "function", "typeParameter"].includes(kind)
832
862
  ? {semanticDeclarationId: /** @type {{id?: string}} */ (node).id}
833
863
  : {})
834
864
  })
@@ -1009,6 +1039,7 @@ function resolveSymbols(module, records) {
1009
1039
  for (const [index, argument] of (type.arguments ?? []).entries()) visitType(argument, `${path}/arguments/${index}`)
1010
1040
  }
1011
1041
  else if (type.kind == "ErrorType") reference(type, errorSymbols.get(type.declarationId), "type", path)
1042
+ else if (type.kind == "InterfaceType") reference(type, interfaceSymbols.get(type.declarationId), "type", path)
1012
1043
  else if (type.kind == "ReferenceType" || type.kind == "OwnedReferenceType") reference(type, classSymbols.get(type.declarationId), "type", path)
1013
1044
  else if (type.kind == "OwnedResourceType") reference(type, resourceSymbols.get(type.resourceId), "type", path)
1014
1045
  else if (type.kind == "ListType") visitType(type.elementType, `${path}/elementType`)
@@ -1020,7 +1051,7 @@ function resolveSymbols(module, records) {
1020
1051
 
1021
1052
  /**
1022
1053
  * Attaches one resolved symbol reference.
1023
- * @param {import("./types.js").IdentifierExpression | import("./types.js").ReceiverExpression | import("./types.js").CallExpression | import("./types.js").EffectCallExpression | import("./types.js").MethodCallExpression | import("./types.js").TypeVariableReference | import("./types.js").RecordType | import("./types.js").ReferenceType | import("./types.js").OwnedReferenceType | import("./types.js").OwnedResourceType | import("./types.js").RecordConstruction | import("./types.js").ReferenceConstruction | import("./types.js").MemberRead | import("./types.js").PrivateFieldRead | import("./types.js").PrivateFieldWriteStatement | import("./types.js").RethrowStatement | import("./types.js").ErrorType | import("./types.js").ErrorConstruction} node - Reference node.
1054
+ * @param {import("./types.js").IdentifierExpression | import("./types.js").ReceiverExpression | import("./types.js").CallExpression | import("./types.js").EffectCallExpression | import("./types.js").MethodCallExpression | import("./types.js").TypeVariableReference | import("./types.js").RecordType | import("./types.js").ReferenceType | import("./types.js").InterfaceType | import("./types.js").OwnedReferenceType | import("./types.js").OwnedResourceType | import("./types.js").RecordConstruction | import("./types.js").ReferenceConstruction | import("./types.js").MemberRead | import("./types.js").PrivateFieldRead | import("./types.js").PrivateFieldWriteStatement | import("./types.js").RethrowStatement | import("./types.js").ErrorType | import("./types.js").ErrorConstruction} node - Reference node.
1024
1055
  * @param {string | undefined} symbolId - Resolved symbol.
1025
1056
  * @param {"type" | "construct" | "member" | "read" | "write" | "call"} role - Reference role.
1026
1057
  * @param {string} path - Reference occurrence path.
@@ -8,8 +8,8 @@
8
8
  /** @typedef {SemanticTypeName | "void"} FunctionReturnTypeName */
9
9
  /** @typedef {"IntegerNegate" | "BooleanNot"} SemanticUnaryOperation */
10
10
  /** @typedef {"IntegerAdd" | "IntegerSubtract" | "IntegerMultiply" | "BooleanAnd" | "BooleanOr" | "IntegerEqual" | "IntegerNotEqual" | "BooleanEqual" | "BooleanNotEqual" | "StringEqual" | "StringNotEqual" | "IntegerLessThan" | "IntegerLessThanOrEqual" | "IntegerGreaterThan" | "IntegerGreaterThanOrEqual" | "StringConcat"} SemanticBinaryOperation */
11
- /** @typedef {"capability" | "resource" | "failure" | "operation" | "record" | "class" | "error" | "field" | "constructor" | "method" | "function" | "typeParameter" | "parameter" | "local" | "iteration" | "catch"} SemanticSymbolKind */
12
- /** @typedef {"record" | "class" | "error" | "function"} SemanticDeclarationKind */
11
+ /** @typedef {"capability" | "resource" | "failure" | "operation" | "record" | "interface" | "interfaceMethod" | "class" | "error" | "field" | "constructor" | "method" | "function" | "typeParameter" | "parameter" | "local" | "iteration" | "catch"} SemanticSymbolKind */
12
+ /** @typedef {"record" | "interface" | "class" | "error" | "function"} SemanticDeclarationKind */
13
13
  /** @typedef {"declaration" | "type" | "construct" | "member" | "read" | "write" | "call"} SemanticSymbolRole */
14
14
  /** @typedef {"parse" | "generate" | "restore" | "compile" | "link" | "validate" | "instantiate" | "execute"} AcceptanceStage */
15
15
  /** @typedef {"entry" | "source" | "manifest" | "support" | "mapping" | "resource" | "loader"} GeneratedArtifactRole */
@@ -186,6 +186,7 @@
186
186
  * @property {boolean} typedErrors - Task 011 nominal unchecked errors, raises, and exact typed catches.
187
187
  * @property {boolean} typeParametersAndGenerics - Task 012 invariant unbounded type parameters and closed generic applications.
188
188
  * @property {boolean} referenceClasses - Task 033 nominal reference classes, private instance state, exact constructors, and receiver methods.
189
+ * @property {boolean} boundedSubtyping - Task 048 nominal interfaces with exact implementation contracts and implicit upcast (requires referenceClasses).
189
190
  * @property {boolean} effectfulCapabilitiesAndResources - Task 034 authorized host effects, typed failures, and owned resources.
190
191
  */
191
192
 
@@ -700,7 +701,14 @@
700
701
  * @property {SemanticNodeSourceProvenance} [sourceProvenance] - Parser-owned type-name range.
701
702
  */
702
703
 
703
- /** @typedef {TypeReference | TypeVariableReference | ListType | MapType | OrderedMapType | OptionalType | RecordType | ReferenceType | OwnedResourceType | OwnedReferenceType} SemanticValueType */
704
+ /**
705
+ * @typedef InterfaceType
706
+ * @property {"InterfaceType"} kind - Nominal bounded-subtyping interface type discriminator.
707
+ * @property {string} declarationId - Stable module-local interface declaration identity.
708
+ * @property {SemanticNodeSourceProvenance} [sourceProvenance] - Parser-owned type-name range.
709
+ */
710
+
711
+ /** @typedef {TypeReference | TypeVariableReference | ListType | MapType | OrderedMapType | OptionalType | RecordType | ReferenceType | OwnedResourceType | OwnedReferenceType | InterfaceType} SemanticValueType */
704
712
  /** @typedef {SemanticValueType | ErrorType} SemanticBindingType */
705
713
 
706
714
  /**
@@ -712,7 +720,7 @@
712
720
 
713
721
  /** @typedef {SemanticValueType | FunctionReturnTypeReference} SemanticFunctionReturnType */
714
722
 
715
- /** @typedef {SemanticTypeName | {kind: "TypeVariableReference", parameterId: string} | {kind: "ListType", elementType: SemanticTypeIdentity} | {kind: "MapType", keyType: SemanticTypeIdentity, valueType: SemanticTypeIdentity} | {kind: "OrderedMapType", keyType: SemanticTypeIdentity, valueType: SemanticTypeIdentity, order: "insertion"} | {kind: "OptionalType", valueType: SemanticTypeIdentity} | {kind: "RecordType", declarationId: string, arguments?: SemanticTypeIdentity[]} | {kind: "ReferenceType", declarationId: string} | {kind: "OwnedResourceType", resourceId: string} | {kind: "OwnedReferenceType", declarationId: string}} SemanticTypeIdentity */
723
+ /** @typedef {SemanticTypeName | {kind: "TypeVariableReference", parameterId: string} | {kind: "ListType", elementType: SemanticTypeIdentity} | {kind: "MapType", keyType: SemanticTypeIdentity, valueType: SemanticTypeIdentity} | {kind: "OrderedMapType", keyType: SemanticTypeIdentity, valueType: SemanticTypeIdentity, order: "insertion"} | {kind: "OptionalType", valueType: SemanticTypeIdentity} | {kind: "RecordType", declarationId: string, arguments?: SemanticTypeIdentity[]} | {kind: "ReferenceType", declarationId: string} | {kind: "OwnedResourceType", resourceId: string} | {kind: "OwnedReferenceType", declarationId: string} | {kind: "InterfaceType", declarationId: string}} SemanticTypeIdentity */
716
724
  /** @typedef {SemanticTypeIdentity | "void"} FunctionReturnTypeIdentity */
717
725
 
718
726
  /**
@@ -1345,10 +1353,33 @@
1345
1353
  * @property {Block} body - Method body.
1346
1354
  * @property {readonly ["host"]} [effects] - Inferred checked host-effect fact.
1347
1355
  * @property {string[]} [failureIds] - Ordered capability failures reachable through the method.
1356
+ * @property {{interfaceId: string, methodId: string}} [implements] - Exact satisfied interface member, required after validation when the method satisfies an interface contract.
1348
1357
  * @property {SourceLocation} location - Complete method location.
1349
1358
  * @property {SemanticNodeSourceProvenance} [sourceProvenance] - Parser-owned method-name range.
1350
1359
  */
1351
1360
 
1361
+ /**
1362
+ * @typedef InterfaceMethodDeclaration
1363
+ * @property {"InterfaceMethodDeclaration"} kind - Signature-only interface contract member.
1364
+ * @property {string} [id] - Stable interface-scoped method identity, required after validation.
1365
+ * @property {string} name - Source-visible method name.
1366
+ * @property {Parameter[]} parameters - Exact positional required parameters with explicit types.
1367
+ * @property {SemanticFunctionReturnType} returnType - Exact value or void return.
1368
+ * @property {SourceLocation} location - Complete interface method location.
1369
+ * @property {SemanticNodeSourceProvenance} [sourceProvenance] - Parser-owned method-name range.
1370
+ */
1371
+
1372
+ /**
1373
+ * @typedef InterfaceDeclaration
1374
+ * @property {"InterfaceDeclaration"} kind - Closed signature-only nominal interface with exact implementation contracts.
1375
+ * @property {string} [id] - Stable module-local interface identity, required after validation.
1376
+ * @property {string} name - Source-visible interface name.
1377
+ * @property {InterfaceType[]} [extends] - Direct interface parents in source order; omitted when empty.
1378
+ * @property {InterfaceMethodDeclaration[]} methods - Ordered closed signature set.
1379
+ * @property {SourceLocation} location - Complete interface location.
1380
+ * @property {SemanticNodeSourceProvenance} [sourceProvenance] - Parser-owned interface-name range.
1381
+ */
1382
+
1352
1383
  /**
1353
1384
  * @typedef ClassDeclaration
1354
1385
  * @property {"ClassDeclaration"} kind - Nominal reference class with private mutable state.
@@ -1357,6 +1388,7 @@
1357
1388
  * @property {PrivateField[]} fields - Ordered private instance state.
1358
1389
  * @property {ConstructorDeclaration} constructor - Sole exact constructor.
1359
1390
  * @property {MethodDeclaration[]} methods - Ordered receiver methods.
1391
+ * @property {InterfaceType[]} [implements] - Direct interface contracts in source order; omitted when empty.
1360
1392
  * @property {{kind: "ordinary"} | {kind: "ownedResource", fieldId: string, resourceId: string}} [ownership] - Explicit class ownership profile.
1361
1393
  * @property {SourceLocation} location - Complete class location.
1362
1394
  * @property {SemanticNodeSourceProvenance} [sourceProvenance] - Parser-owned class-name range.
@@ -1391,6 +1423,7 @@
1391
1423
  * @typedef SemanticModule
1392
1424
  * @property {"Module"} kind - Node discriminator.
1393
1425
  * @property {RecordDeclaration[]} [records] - Top-level nominal record declarations in source order; omitted when empty.
1426
+ * @property {InterfaceDeclaration[]} [interfaces] - Top-level nominal interface declarations in source order; omitted when empty.
1394
1427
  * @property {ClassDeclaration[]} [classes] - Top-level nominal reference classes in source order; omitted when empty.
1395
1428
  * @property {ErrorDeclaration[]} [errors] - Top-level nominal unchecked error declarations in source order; omitted when empty.
1396
1429
  * @property {EffectCapabilityDeclaration[]} [capabilities] - Compiler-authorized Task 034 declarations; omission is the legacy empty set.
@@ -1441,6 +1474,7 @@
1441
1474
  * @property {string} id - Stable caller-supplied logical module identity.
1442
1475
  * @property {string} sourceFilename - Explicit source filename; never an implicit read request.
1443
1476
  * @property {RecordDeclaration[]} [records] - Top-level nominal record declarations.
1477
+ * @property {InterfaceDeclaration[]} [interfaces] - Top-level nominal interface declarations.
1444
1478
  * @property {ClassDeclaration[]} [classes] - Compiler-owned facade reference classes.
1445
1479
  * @property {ErrorDeclaration[]} [errors] - Top-level nominal unchecked error declarations.
1446
1480
  * @property {FunctionDeclaration[]} functions - Top-level functions.
@@ -1486,7 +1520,7 @@
1486
1520
  * @property {StdlibFacadeProgramDescriptor} [stdlibFacades] - Complete selected source-language facade closure.
1487
1521
  */
1488
1522
 
1489
- /** @typedef {SemanticModule | SemanticProgramModule | SemanticImport | SemanticExport | RecordDeclaration | ClassDeclaration | ErrorDeclaration | EffectCapabilityDeclaration | EffectResourceDeclaration | EffectFailureDeclaration | EffectOperationDeclaration | RecordField | PrivateField | ConstructorDeclaration | MethodDeclaration | FunctionDeclaration | TypeParameter | Parameter | ValueBinding | CatchBinding | CatchHandler | Block | Statement | EntryPoint | Expression | ErrorConstruction | ErrorType | MapEntry | SemanticValueType | FunctionReturnTypeReference} SemanticNode */
1523
+ /** @typedef {SemanticModule | SemanticProgramModule | SemanticImport | SemanticExport | RecordDeclaration | InterfaceDeclaration | InterfaceMethodDeclaration | ClassDeclaration | ErrorDeclaration | EffectCapabilityDeclaration | EffectResourceDeclaration | EffectFailureDeclaration | EffectOperationDeclaration | RecordField | PrivateField | ConstructorDeclaration | MethodDeclaration | FunctionDeclaration | TypeParameter | Parameter | ValueBinding | CatchBinding | CatchHandler | Block | Statement | EntryPoint | Expression | ErrorConstruction | ErrorType | MapEntry | SemanticValueType | FunctionReturnTypeReference} SemanticNode */
1490
1524
  /** @typedef {SemanticNode} SemanticNodeWithoutLocations */
1491
1525
 
1492
1526
  export {}