jsii 5.9.9-dev.3 → 5.9.9-dev.4

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.
package/lib/validator.js CHANGED
@@ -317,7 +317,15 @@ function _defaultValidations() {
317
317
  if (deepEqual(subType, superType)) {
318
318
  return true;
319
319
  }
320
- // We only support classes, not primitives, not lists
320
+ // Handle array collections (covariant)
321
+ if (spec.isCollectionTypeReference(subType) && spec.isCollectionTypeReference(superType)) {
322
+ if (subType.collection.kind === 'array' && superType.collection.kind === 'array') {
323
+ return _isCovariantOf(subType.collection.elementtype, superType.collection.elementtype);
324
+ }
325
+ // Maps/Records are not allowed to be covariant in C#, so we exclude them here
326
+ return false;
327
+ }
328
+ // We only support classes for named types
321
329
  if (!spec.isNamedTypeReference(subType) || !spec.isNamedTypeReference(superType)) {
322
330
  return false;
323
331
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,mCAAmC;AACnC,6CAA6C;AAC7C,iCAAiC;AACjC,+BAA+B;AAE/B,uDAAmD;AACnD,mDAAiD;AACjD,4CAA4C;AAO5C,MAAa,SAAS;IAGpB,YAAmC,WAAwB,EAAkB,QAAuB;QAAjE,gBAAW,GAAX,WAAW,CAAa;QAAkB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjG,IAAI;QACT,MAAM,WAAW,GAAG,IAAI,KAAK,EAAiB,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAI,KAAK,EAAoB,CAAC;QAEnD,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YAC/C,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5G,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AC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IACD,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC7F,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,eAAe,CAAC,IAAgD;IACvE,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,gGAAgG;QAChG,OAAO,IAAW,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC","sourcesContent":["import * as assert from 'node:assert';\nimport * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport * as ts from 'typescript';\nimport * as Case from './case';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { getRelatedNode } from './node-bindings';\nimport * as bindings from './node-bindings';\nimport { ProjectInfo } from './project-info';\n\nexport interface ValidationResult extends ts.EmitResult {\n readonly usedFeatures?: spec.JsiiFeature[];\n}\n\nexport class Validator implements Emitter {\n public static VALIDATIONS: ValidationFunction[] = _defaultValidations();\n\n public constructor(public readonly projectInfo: ProjectInfo, public readonly assembly: spec.Assembly) {}\n\n public emit(): ValidationResult {\n const diagnostics = new Array<ts.Diagnostic>();\n const usedFeatures = new Array<spec.JsiiFeature>();\n\n for (const validation of Validator.VALIDATIONS) {\n validation(this, this.assembly, diagnostics.push.bind(diagnostics), usedFeatures.push.bind(usedFeatures));\n }\n\n return {\n diagnostics: diagnostics,\n emitSkipped: diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error),\n usedFeatures,\n };\n }\n}\n\nexport type DiagnosticEmitter = (diag: JsiiDiagnostic) => void;\nexport type FeatureTracker = (feat: spec.JsiiFeature) => void;\nexport type ValidationFunction = (\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeatures: FeatureTracker,\n) => void;\n\nfunction _defaultValidations(): ValidationFunction[] {\n return [\n _enumMembersMustUserUpperSnakeCase,\n _memberNamesMustUseCamelCase,\n _staticConstantNamesMustUseUpperSnakeCase,\n _memberNamesMustNotLookLikeJavaGettersOrSetters,\n _allTypeReferencesAreValid,\n _inheritanceDoesNotChangeContracts,\n _staticMembersAndNestedTypesMustNotSharePascalCaseName,\n _abstractClassesMustImplementAllProperties,\n ];\n\n function _enumMembersMustUserUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isEnumType(type)) {\n continue;\n }\n\n for (const member of type.members) {\n if (member.name && !isConstantCase(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n }\n\n function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const { member, type } of _allMembers(assembly)) {\n if (member.static && (member as spec.Property).const) {\n continue;\n }\n if (member.name && member.name !== Case.camel(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n\n function _staticConstantNamesMustUseUpperSnakeCase(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.static || !(member as spec.Property).const) {\n continue;\n }\n if (\n member.name &&\n !isConstantCase(member.name) &&\n member.name !== Case.pascal(member.name) &&\n member.name !== Case.camel(member.name)\n ) {\n diagnostic(JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.createDetached(member.name, type.name));\n }\n }\n }\n\n function _memberNamesMustNotLookLikeJavaGettersOrSetters(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.name) {\n continue;\n }\n const snakeName = Case.snake(member.name);\n if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) {\n diagnostic(JsiiDiagnostic.JSII_5000_JAVA_GETTERS.createDetached(member.name, type.name));\n } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters ?? []).length === 1) {\n diagnostic(JsiiDiagnostic.JSII_5001_JAVA_SETTERS.createDetached(member.name, type.name));\n }\n }\n }\n\n function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const typeRef of _allTypeReferences(assembly)) {\n const [assm] = typeRef.fqn.split('.');\n if (assembly.name === assm) {\n if (!(typeRef.fqn in (assembly.types ?? {}))) {\n diagnostic(\n JsiiDiagnostic.JSII_3000_EXPORTED_API_USES_HIDDEN_TYPE.create(\n typeRef.node!, // Pretend there is always a value\n typeRef.fqn,\n ),\n );\n }\n continue;\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n if (!foreignAssm) {\n diagnostic(JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.createDetached(assm));\n continue;\n }\n if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {\n diagnostic(JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.createDetached(typeRef));\n }\n }\n }\n\n function _inheritanceDoesNotChangeContracts(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeature: FeatureTracker,\n ) {\n for (const type of _allTypes(assembly)) {\n if (spec.isClassType(type)) {\n for (const method of type.methods ?? []) {\n _validateMethodOverride(method, type);\n }\n for (const property of type.properties ?? []) {\n _validatePropertyOverride(property, type);\n }\n }\n if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {\n for (const method of _allImplementations(type, (t) => t.methods)) {\n _validateMethodImplementation(method, type);\n }\n for (const property of _allImplementations(type, (t) => t.properties)) {\n _validatePropertyImplementation(property, type);\n }\n }\n }\n\n /**\n * Lists all \"implementations\" from the given type, using the provided\n * implementation getter. Note that abstract members may be part of the\n * result (in particular, if `type` is an interface type, or if it's an\n * abstract class with unimplemented members) -- I just couldn't come up\n * with a name that actually describes this.\n *\n * @param type the type which implemented members are needed.\n * @param getter the getter to obtain methods or properties from the type.\n *\n * @returns a list of members (possibly empty, always defined)\n */\n function _allImplementations<T extends spec.Property | spec.Method>(\n type: spec.ClassType | spec.InterfaceType,\n getter: (type: spec.ClassType | spec.InterfaceType) => T[] | undefined,\n ): T[] {\n const result = new Array<T>();\n const known = new Set<string>();\n\n for (const member of getter(type) ?? []) {\n result.push(member);\n known.add(member.name);\n }\n\n if (spec.isClassType(type) && type.base) {\n // We have a parent class, collect their concrete members, too (recursively)...\n const base = _dereference(type.base, assembly, validator);\n assert(base != null && spec.isClassType(base));\n for (const member of _allImplementations(base, getter)) {\n if (known.has(member.name)) {\n continue;\n }\n // The member is copied, so that its `overrides` property won't be\n // altered, since this member is \"borrowed\" from a parent type. We\n // only check it, but should not record `overrides` relationships to\n // it as those could be invalid per the parent type (i.e: the parent\n // member may not be able to implement an interface, if that type does\n // not actually declare implementing that).\n const memberCopy = { ...member };\n // Forward the related node if there's one, so diagnostics are bound.\n const node = bindings.getRelatedNode(member);\n if (node != null) {\n bindings.setRelatedNode(memberCopy, node);\n }\n\n result.push(memberCopy);\n known.add(member.name);\n }\n }\n\n return result;\n }\n\n function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.methods ?? []).find((m) => m.name === method.name);\n if (!overridden) {\n return _validateMethodOverride(method, baseType);\n }\n _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`, {\n returnTypeCovariance: true,\n });\n method.overrides = baseType.fqn;\n return true;\n }\n\n function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.properties ?? []).find((p) => p.name === property.name);\n if (!overridden) {\n return _validatePropertyOverride(property, baseType);\n }\n _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`, {\n covariance: true,\n });\n property.overrides = baseType.fqn;\n return true;\n }\n\n function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validateMethodImplementation(method, _dereference(type.base, assembly, validator) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);\n if (implemented) {\n _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`, {\n returnTypeCovariance: false,\n });\n // We won't replace a previous overrides declaration from a method override, as those have\n // higher precedence than an initial implementation.\n method.overrides = method.overrides ?? iface;\n return true;\n }\n if (_validateMethodImplementation(method, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _validatePropertyImplementation(\n property: spec.Property,\n type: spec.ClassType | spec.InterfaceType,\n ): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validatePropertyImplementation(\n property,\n _dereference(type.base, assembly, validator) as spec.ClassType,\n );\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);\n if (implemented) {\n _assertPropertiesMatch(\n implemented,\n property,\n `${type.fqn}#${property.name}`,\n `implementing ${ifaceType.fqn}`,\n { covariance: false },\n );\n // We won't replace a previous overrides declaration from a property override, as those\n // have higher precedence than an initial implementation.\n property.overrides = property.overrides ?? ifaceType.fqn;\n return true;\n }\n if (_validatePropertyImplementation(property, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _assertSignaturesMatch(\n expected: spec.Method,\n actual: spec.Method,\n label: string,\n action: string,\n opts: {\n returnTypeCovariance: boolean;\n },\n ) {\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.createDetached(\n label,\n action,\n actVisibility,\n expVisibility,\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.returns, expected.returns)) {\n const actualReturnType = actual.returns?.type;\n const expectedReturnType = expected.returns?.type;\n\n if (\n // return type covariance is allowed\n opts.returnTypeCovariance &&\n // static members can never change\n !actual.static &&\n // this is a valid covariant return type (actual is more specific than expected)\n _isCovariantOf(actualReturnType, expectedReturnType)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n const expType = spec.describeTypeReference(expectedReturnType);\n const actType = spec.describeTypeReference(actualReturnType);\n diagnostic(\n JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType),\n );\n }\n }\n const expectedParams = expected.parameters ?? [];\n const actualParams = actual.parameters ?? [];\n if (expectedParams.length !== actualParams.length) {\n diagnostic(\n JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.createDetached(\n label,\n action,\n actualParams.length,\n expectedParams.length,\n ),\n );\n return;\n }\n for (let i = 0; i < expectedParams.length; i++) {\n const expParam = expectedParams[i];\n const actParam = actualParams[i];\n if (!deepEqual(expParam.type, actParam.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.createDetached(label, action, actParam, expParam),\n );\n }\n // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)\n if (expParam.variadic !== actParam.variadic) {\n diagnostic(\n JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.createDetached(\n label,\n action,\n actParam.variadic,\n expParam.variadic,\n ),\n );\n }\n if (expParam.optional !== actParam.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.createDetached(label, action, actParam, expParam),\n );\n }\n }\n }\n\n /**\n * Check if subType is indeed covariant to superType\n */\n function _isCovariantOf(subType?: spec.TypeReference, superType?: spec.TypeReference): boolean {\n // one void, while other isn't => not covariant\n if ((subType === undefined) !== (superType === undefined)) {\n return false;\n }\n\n // Same type is always covariant\n if (deepEqual(subType, superType)) {\n return true;\n }\n\n // We only support classes, not primitives, not lists\n if (!spec.isNamedTypeReference(subType) || !spec.isNamedTypeReference(superType)) {\n return false;\n }\n\n const subTypeSpec = _dereference(subType.fqn, assembly, validator);\n const superTypeSpec = _dereference(superType.fqn, assembly, validator);\n\n if (!subTypeSpec || !superTypeSpec) {\n return false;\n }\n\n // Handle class-to-class inheritance\n if (spec.isClassType(subTypeSpec) && spec.isClassType(superTypeSpec)) {\n return _classExtendsClass(subTypeSpec, superType.fqn);\n }\n\n // Handle interface-to-interface inheritance\n if (spec.isInterfaceType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {\n return _interfaceExtendsInterface(subTypeSpec, superType.fqn);\n }\n\n // Handle class implementing interface\n if (spec.isClassType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {\n return _classImplementsInterface(subTypeSpec, superType.fqn);\n }\n\n return false;\n }\n\n function _classExtendsClass(classType: spec.ClassType, targetFqn: string): boolean {\n let current = classType;\n while (current.base) {\n if (current.base === targetFqn) {\n return true;\n }\n const baseType = _dereference(current.base, assembly, validator);\n if (!spec.isClassType(baseType)) {\n break;\n }\n current = baseType;\n }\n return false;\n }\n\n function _classImplementsInterface(classType: spec.ClassType, interfaceFqn: string): boolean {\n // Check direct interfaces\n if (classType.interfaces?.includes(interfaceFqn)) {\n return true;\n }\n\n // Check inherited interfaces\n if (classType.interfaces) {\n for (const iface of classType.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator);\n if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, interfaceFqn)) {\n return true;\n }\n }\n }\n\n // Check base class interfaces\n if (classType.base) {\n const baseType = _dereference(classType.base, assembly, validator);\n if (spec.isClassType(baseType)) {\n return _classImplementsInterface(baseType, interfaceFqn);\n }\n }\n\n return false;\n }\n\n function _interfaceExtendsInterface(interfaceType: spec.InterfaceType, targetFqn: string): boolean {\n if (interfaceType.fqn === targetFqn) {\n return true;\n }\n\n if (interfaceType.interfaces) {\n for (const iface of interfaceType.interfaces) {\n if (iface === targetFqn) {\n return true;\n }\n const ifaceType = _dereference(iface, assembly, validator);\n if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, targetFqn)) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n function _assertPropertiesMatch(\n expected: spec.Property,\n actual: spec.Property,\n label: string,\n action: string,\n opts: {\n covariance: boolean;\n },\n ) {\n const actualNode = bindings.getPropertyRelatedNode(actual);\n const expectedNode = bindings.getPropertyRelatedNode(expected);\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.type, expected.type)) {\n if (\n // return type covariance is allowed\n opts.covariance &&\n // static members can never change\n !actual.static &&\n // immutable properties may change in some case, as long as they are covariant\n actual.immutable &&\n _isCovariantOf(actual.type, expected.type)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n diagnostic(\n JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.type,\n expected.type,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n if (expected.immutable !== actual.immutable) {\n diagnostic(\n JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(\n actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(actualNode),\n label,\n action,\n actual.immutable,\n expected.immutable,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n if (expected.optional !== actual.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(\n actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.optional,\n expected.optional,\n ).maybeAddRelatedInformation(\n expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n }\n\n /**\n * Abstract classes that implement an interface should have a declaration for every member.\n *\n * For non-optional members, TypeScript already enforces this. This leaves the user the\n * ability to forget optional properties (`readonly prop?: string`).\n *\n * At least our codegen for this case fails in C#, and I'm not convinced it does the right\n * thing in Java either. So we will disallow this, and require users to declare these\n * fields on the class. It can always be `public abstract readonly prop?: string` if they\n * don't want to give an implementation yet.\n */\n function _abstractClassesMustImplementAllProperties(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isClassType(type) || !type.abstract) {\n continue;\n }\n\n const classProps = collectClassProps(type, new Set());\n\n for (const implFqn of type.interfaces ?? []) {\n checkInterfacePropsImplemented(implFqn, type, classProps);\n }\n }\n\n /**\n * Return all property names declared on this class and its base classes\n */\n function collectClassProps(type: spec.ClassType, into: Set<string>): Set<string> {\n for (const prop of type.properties ?? []) {\n into.add(prop.name);\n }\n\n if (type.base) {\n const base = _dereference(type.base, assembly, validator);\n if (spec.isClassType(base)) {\n collectClassProps(base, into);\n }\n }\n\n return into;\n }\n\n function checkInterfacePropsImplemented(interfaceFqn: string, cls: spec.ClassType, propNames: Set<string>) {\n const intf = _dereference(interfaceFqn, assembly, validator);\n if (!spec.isInterfaceType(intf)) {\n return;\n }\n\n // We only have to check for optional properties, because anything required\n // would have been caught by the TypeScript compiler already.\n for (const prop of intf.properties ?? []) {\n if (!prop.optional) {\n continue;\n }\n\n if (!propNames.has(prop.name)) {\n diagnostic(\n JsiiDiagnostic.JSII_5021_ABSTRACT_CLASS_MISSING_PROP_IMPL.create(\n bindings.getClassOrInterfaceRelatedNode(cls),\n intf,\n cls,\n prop.name,\n ).maybeAddRelatedInformation(bindings.getPropertyRelatedNode(prop), 'The implemented declaration is here.'),\n );\n }\n }\n\n for (const extFqn of intf.interfaces ?? []) {\n checkInterfacePropsImplemented(extFqn, cls, propNames);\n }\n }\n }\n\n function _staticMembersAndNestedTypesMustNotSharePascalCaseName(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const nestedType of Object.values(assembly.types ?? {})) {\n if (nestedType.namespace == null) {\n continue;\n }\n const nestingType = assembly.types![`${assembly.name}.${nestedType.namespace}`];\n if (nestingType == null) {\n continue;\n }\n const nestedTypeName = Case.pascal(nestedType.name);\n for (const { name, member } of staticMembers(nestingType)) {\n if (name === nestedTypeName) {\n let diag = JsiiDiagnostic.JSII_5020_STATIC_MEMBER_CONFLICTS_WITH_NESTED_TYPE.create(\n getRelatedNode(member)!,\n nestingType,\n member,\n nestedType,\n );\n const nestedTypeNode = getRelatedNode(nestedType);\n if (nestedTypeNode != null) {\n diag = diag.addRelatedInformation(nestedTypeNode, 'This is the conflicting nested type declaration');\n }\n diagnostic(diag);\n }\n }\n }\n\n function staticMembers(type: spec.Type) {\n if (spec.isClassOrInterfaceType(type)) {\n return [\n ...(type.methods?.filter((method) => method.static) ?? []),\n ...(type.properties?.filter((prop) => prop.static) ?? []),\n ].map((member) => ({ name: Case.pascal(member.name), member }));\n }\n return type.members.map((member) => ({ name: member.name, member }));\n }\n }\n}\n\nfunction _allTypes(assm: spec.Assembly): spec.Type[] {\n return Object.values(assm.types ?? {});\n}\n\nfunction _allMethods(assm: spec.Assembly): Array<{ member: spec.Method; type: spec.Type }> {\n const methods = new Array<{ member: spec.Method; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.methods) {\n continue;\n }\n for (const method of type.methods) methods.push({ member: method, type });\n }\n return methods;\n}\n\nfunction _allProperties(assm: spec.Assembly): Array<{ member: spec.Property; type: spec.Type }> {\n const properties = new Array<{ member: spec.Property; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.properties) {\n continue;\n }\n for (const property of type.properties) properties.push({ member: property, type });\n }\n return properties;\n}\n\nfunction _allMembers(assm: spec.Assembly): Array<{ member: spec.Property | spec.Method; type: spec.Type }> {\n return [..._allMethods(assm), ..._allProperties(assm)];\n}\n\ninterface AnnotatedTypeReference extends spec.NamedTypeReference {\n readonly node: ts.Node | undefined;\n}\n\nfunction _allTypeReferences(assm: spec.Assembly): readonly AnnotatedTypeReference[] {\n const typeReferences = new Array<AnnotatedTypeReference>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (spec.isClassType(type)) {\n const node = bindings.getClassRelatedNode(type);\n if (type.base) {\n typeReferences.push({\n fqn: type.base,\n node: node?.heritageClauses?.find((hc) => hc.token === ts.SyntaxKind.ExtendsKeyword)?.types[0],\n });\n }\n if (type.initializer?.parameters) {\n for (const param of type.initializer.parameters) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n }\n if (type.interfaces) {\n const node = bindings.getClassOrInterfaceRelatedNode(type);\n for (const iface of type.interfaces) {\n typeReferences.push({\n fqn: iface,\n node: node?.heritageClauses?.find(\n (hc) =>\n hc.token ===\n (spec.isInterfaceType(type) ? ts.SyntaxKind.ImplementsKeyword : ts.SyntaxKind.ExtendsKeyword),\n ),\n });\n }\n }\n }\n for (const { member: prop } of _allProperties(assm)) {\n _collectTypeReferences(prop.type, bindings.getPropertyRelatedNode(prop)?.type);\n }\n for (const { member: meth } of _allMethods(assm)) {\n if (meth.returns) {\n _collectTypeReferences(meth.returns.type, bindings.getMethodRelatedNode(meth)?.type);\n }\n for (const param of meth.parameters ?? []) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n return typeReferences;\n\n function _collectTypeReferences(type: spec.TypeReference, node: ts.Node | undefined): void {\n if (spec.isNamedTypeReference(type)) {\n typeReferences.push({ ...type, node });\n } else if (spec.isCollectionTypeReference(type)) {\n _collectTypeReferences(type.collection.elementtype, node);\n } else if (spec.isUnionTypeReference(type)) {\n for (const t of type.union.types) _collectTypeReferences(t, node);\n }\n }\n}\n\nfunction _dereference(\n typeRef: string | spec.NamedTypeReference,\n assembly: spec.Assembly,\n validator: Validator,\n): spec.Type | undefined {\n if (typeof typeRef !== 'string') {\n typeRef = typeRef.fqn;\n }\n const [assm] = typeRef.split('.');\n if (assembly.name === assm) {\n return assembly.types?.[typeRef];\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n return foreignAssm?.types?.[typeRef];\n}\n\nfunction _isEmpty(array: undefined | any[]): array is undefined {\n return array == null || array.length === 0;\n}\n\n/**\n * Return whether an identifier only consists of upperchase characters, digits and underscores\n *\n * We have our own check here (isConstantCase) which is more lenient than what\n * `case.constant()` prescribes. We also want to allow combinations of letters\n * and digits without underscores: `C5A`, which `case` would force to `C5_A`.\n * The hint we print will still use `case.constant()` but that is fine.\n */\nfunction isConstantCase(x: string) {\n return !/[^A-Z0-9_]/.exec(x);\n}\n\n/**\n * Obtains the name of the given declaration, if it has one, or returns the declaration itself.\n * This function is meant to be used as a convenience to obtain the `ts.Node` to bind a\n * `JsiiDianostic` instance on.\n *\n * It may return `undefined` but is typed as `ts.Node` so that it is easier to use with\n * `JsiiDiagnostic` factories.\n *\n * @param decl the declaration which name is needed.\n *\n * @returns the name of the declaration if it has one, or the declaration itself. Might return\n * `undefined` if the provided declaration is undefined.\n */\nfunction declarationName(decl: ts.Declaration | ts.Expression | undefined): ts.Node {\n if (decl == null) {\n // Pretend we returned a node - this is used to create diagnostics, worst case it'll be unbound.\n return decl as any;\n }\n return ts.getNameOfDeclaration(decl) ?? decl;\n}\n"]}
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;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S,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC7F,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,eAAe,CAAC,IAAgD;IACvE,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,gGAAgG;QAChG,OAAO,IAAW,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC","sourcesContent":["import * as assert from 'node:assert';\nimport * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport * as ts from 'typescript';\nimport * as Case from './case';\nimport { Emitter } from './emitter';\nimport { JsiiDiagnostic } from './jsii-diagnostic';\nimport { getRelatedNode } from './node-bindings';\nimport * as bindings from './node-bindings';\nimport { ProjectInfo } from './project-info';\n\nexport interface ValidationResult extends ts.EmitResult {\n readonly usedFeatures?: spec.JsiiFeature[];\n}\n\nexport class Validator implements Emitter {\n public static VALIDATIONS: ValidationFunction[] = _defaultValidations();\n\n public constructor(public readonly projectInfo: ProjectInfo, public readonly assembly: spec.Assembly) {}\n\n public emit(): ValidationResult {\n const diagnostics = new Array<ts.Diagnostic>();\n const usedFeatures = new Array<spec.JsiiFeature>();\n\n for (const validation of Validator.VALIDATIONS) {\n validation(this, this.assembly, diagnostics.push.bind(diagnostics), usedFeatures.push.bind(usedFeatures));\n }\n\n return {\n diagnostics: diagnostics,\n emitSkipped: diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error),\n usedFeatures,\n };\n }\n}\n\nexport type DiagnosticEmitter = (diag: JsiiDiagnostic) => void;\nexport type FeatureTracker = (feat: spec.JsiiFeature) => void;\nexport type ValidationFunction = (\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeatures: FeatureTracker,\n) => void;\n\nfunction _defaultValidations(): ValidationFunction[] {\n return [\n _enumMembersMustUserUpperSnakeCase,\n _memberNamesMustUseCamelCase,\n _staticConstantNamesMustUseUpperSnakeCase,\n _memberNamesMustNotLookLikeJavaGettersOrSetters,\n _allTypeReferencesAreValid,\n _inheritanceDoesNotChangeContracts,\n _staticMembersAndNestedTypesMustNotSharePascalCaseName,\n _abstractClassesMustImplementAllProperties,\n ];\n\n function _enumMembersMustUserUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isEnumType(type)) {\n continue;\n }\n\n for (const member of type.members) {\n if (member.name && !isConstantCase(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8001_ALL_CAPS_ENUM_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n }\n\n function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const { member, type } of _allMembers(assembly)) {\n if (member.static && (member as spec.Property).const) {\n continue;\n }\n if (member.name && member.name !== Case.camel(member.name)) {\n diagnostic(JsiiDiagnostic.JSII_8002_CAMEL_CASED_MEMBERS.createDetached(member.name, type.fqn));\n }\n }\n }\n\n function _staticConstantNamesMustUseUpperSnakeCase(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.static || !(member as spec.Property).const) {\n continue;\n }\n if (\n member.name &&\n !isConstantCase(member.name) &&\n member.name !== Case.pascal(member.name) &&\n member.name !== Case.camel(member.name)\n ) {\n diagnostic(JsiiDiagnostic.JSII_8003_STATIC_CONST_CASING.createDetached(member.name, type.name));\n }\n }\n }\n\n function _memberNamesMustNotLookLikeJavaGettersOrSetters(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const { member, type } of _allMembers(assembly)) {\n if (!member.name) {\n continue;\n }\n const snakeName = Case.snake(member.name);\n if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) {\n diagnostic(JsiiDiagnostic.JSII_5000_JAVA_GETTERS.createDetached(member.name, type.name));\n } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters ?? []).length === 1) {\n diagnostic(JsiiDiagnostic.JSII_5001_JAVA_SETTERS.createDetached(member.name, type.name));\n }\n }\n }\n\n function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) {\n for (const typeRef of _allTypeReferences(assembly)) {\n const [assm] = typeRef.fqn.split('.');\n if (assembly.name === assm) {\n if (!(typeRef.fqn in (assembly.types ?? {}))) {\n diagnostic(\n JsiiDiagnostic.JSII_3000_EXPORTED_API_USES_HIDDEN_TYPE.create(\n typeRef.node!, // Pretend there is always a value\n typeRef.fqn,\n ),\n );\n }\n continue;\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n if (!foreignAssm) {\n diagnostic(JsiiDiagnostic.JSII_9000_UNKNOWN_MODULE.createDetached(assm));\n continue;\n }\n if (!(typeRef.fqn in (foreignAssm.types ?? {}))) {\n diagnostic(JsiiDiagnostic.JSII_9001_TYPE_NOT_FOUND.createDetached(typeRef));\n }\n }\n }\n\n function _inheritanceDoesNotChangeContracts(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n useFeature: FeatureTracker,\n ) {\n for (const type of _allTypes(assembly)) {\n if (spec.isClassType(type)) {\n for (const method of type.methods ?? []) {\n _validateMethodOverride(method, type);\n }\n for (const property of type.properties ?? []) {\n _validatePropertyOverride(property, type);\n }\n }\n if (spec.isClassOrInterfaceType(type) && (type.interfaces?.length ?? 0) > 0) {\n for (const method of _allImplementations(type, (t) => t.methods)) {\n _validateMethodImplementation(method, type);\n }\n for (const property of _allImplementations(type, (t) => t.properties)) {\n _validatePropertyImplementation(property, type);\n }\n }\n }\n\n /**\n * Lists all \"implementations\" from the given type, using the provided\n * implementation getter. Note that abstract members may be part of the\n * result (in particular, if `type` is an interface type, or if it's an\n * abstract class with unimplemented members) -- I just couldn't come up\n * with a name that actually describes this.\n *\n * @param type the type which implemented members are needed.\n * @param getter the getter to obtain methods or properties from the type.\n *\n * @returns a list of members (possibly empty, always defined)\n */\n function _allImplementations<T extends spec.Property | spec.Method>(\n type: spec.ClassType | spec.InterfaceType,\n getter: (type: spec.ClassType | spec.InterfaceType) => T[] | undefined,\n ): T[] {\n const result = new Array<T>();\n const known = new Set<string>();\n\n for (const member of getter(type) ?? []) {\n result.push(member);\n known.add(member.name);\n }\n\n if (spec.isClassType(type) && type.base) {\n // We have a parent class, collect their concrete members, too (recursively)...\n const base = _dereference(type.base, assembly, validator);\n assert(base != null && spec.isClassType(base));\n for (const member of _allImplementations(base, getter)) {\n if (known.has(member.name)) {\n continue;\n }\n // The member is copied, so that its `overrides` property won't be\n // altered, since this member is \"borrowed\" from a parent type. We\n // only check it, but should not record `overrides` relationships to\n // it as those could be invalid per the parent type (i.e: the parent\n // member may not be able to implement an interface, if that type does\n // not actually declare implementing that).\n const memberCopy = { ...member };\n // Forward the related node if there's one, so diagnostics are bound.\n const node = bindings.getRelatedNode(member);\n if (node != null) {\n bindings.setRelatedNode(memberCopy, node);\n }\n\n result.push(memberCopy);\n known.add(member.name);\n }\n }\n\n return result;\n }\n\n function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.methods ?? []).find((m) => m.name === method.name);\n if (!overridden) {\n return _validateMethodOverride(method, baseType);\n }\n _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`, {\n returnTypeCovariance: true,\n });\n method.overrides = baseType.fqn;\n return true;\n }\n\n function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean {\n if (!type.base) {\n return false;\n }\n const baseType = _dereference(type.base, assembly, validator) as spec.ClassType;\n if (!baseType) {\n return false;\n }\n const overridden = (baseType.properties ?? []).find((p) => p.name === property.name);\n if (!overridden) {\n return _validatePropertyOverride(property, baseType);\n }\n _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`, {\n covariance: true,\n });\n property.overrides = baseType.fqn;\n return true;\n }\n\n function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validateMethodImplementation(method, _dereference(type.base, assembly, validator) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);\n if (implemented) {\n _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`, {\n returnTypeCovariance: false,\n });\n // We won't replace a previous overrides declaration from a method override, as those have\n // higher precedence than an initial implementation.\n method.overrides = method.overrides ?? iface;\n return true;\n }\n if (_validateMethodImplementation(method, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _validatePropertyImplementation(\n property: spec.Property,\n type: spec.ClassType | spec.InterfaceType,\n ): boolean {\n if (!type.interfaces) {\n // Abstract classes may not directly implement all members, need to check their supertypes...\n if (spec.isClassType(type) && type.base && type.abstract) {\n return _validatePropertyImplementation(\n property,\n _dereference(type.base, assembly, validator) as spec.ClassType,\n );\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType;\n const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);\n if (implemented) {\n _assertPropertiesMatch(\n implemented,\n property,\n `${type.fqn}#${property.name}`,\n `implementing ${ifaceType.fqn}`,\n { covariance: false },\n );\n // We won't replace a previous overrides declaration from a property override, as those\n // have higher precedence than an initial implementation.\n property.overrides = property.overrides ?? ifaceType.fqn;\n return true;\n }\n if (_validatePropertyImplementation(property, ifaceType)) {\n return true;\n }\n }\n return false;\n }\n\n function _assertSignaturesMatch(\n expected: spec.Method,\n actual: spec.Method,\n label: string,\n action: string,\n opts: {\n returnTypeCovariance: boolean;\n },\n ) {\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.createDetached(\n label,\n action,\n actVisibility,\n expVisibility,\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.returns, expected.returns)) {\n const actualReturnType = actual.returns?.type;\n const expectedReturnType = expected.returns?.type;\n\n if (\n // return type covariance is allowed\n opts.returnTypeCovariance &&\n // static members can never change\n !actual.static &&\n // this is a valid covariant return type (actual is more specific than expected)\n _isCovariantOf(actualReturnType, expectedReturnType)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n const expType = spec.describeTypeReference(expectedReturnType);\n const actType = spec.describeTypeReference(actualReturnType);\n diagnostic(\n JsiiDiagnostic.JSII_5003_OVERRIDE_CHANGES_RETURN_TYPE.createDetached(label, action, actType, expType),\n );\n }\n }\n const expectedParams = expected.parameters ?? [];\n const actualParams = actual.parameters ?? [];\n if (expectedParams.length !== actualParams.length) {\n diagnostic(\n JsiiDiagnostic.JSII_5005_OVERRIDE_CHANGES_PARAM_COUNT.createDetached(\n label,\n action,\n actualParams.length,\n expectedParams.length,\n ),\n );\n return;\n }\n for (let i = 0; i < expectedParams.length; i++) {\n const expParam = expectedParams[i];\n const actParam = actualParams[i];\n if (!deepEqual(expParam.type, actParam.type)) {\n diagnostic(\n JsiiDiagnostic.JSII_5006_OVERRIDE_CHANGES_PARAM_TYPE.createDetached(label, action, actParam, expParam),\n );\n }\n // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false)\n if (expParam.variadic !== actParam.variadic) {\n diagnostic(\n JsiiDiagnostic.JSII_5007_OVERRIDE_CHANGES_VARIADIC.createDetached(\n label,\n action,\n actParam.variadic,\n expParam.variadic,\n ),\n );\n }\n if (expParam.optional !== actParam.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5008_OVERRIDE_CHANGES_PARAM_OPTIONAL.createDetached(label, action, actParam, expParam),\n );\n }\n }\n }\n\n /**\n * Check if subType is indeed covariant to superType\n */\n function _isCovariantOf(subType?: spec.TypeReference, superType?: spec.TypeReference): boolean {\n // one void, while other isn't => not covariant\n if ((subType === undefined) !== (superType === undefined)) {\n return false;\n }\n\n // Same type is always covariant\n if (deepEqual(subType, superType)) {\n return true;\n }\n\n // Handle array collections (covariant)\n if (spec.isCollectionTypeReference(subType) && spec.isCollectionTypeReference(superType)) {\n if (subType.collection.kind === 'array' && superType.collection.kind === 'array') {\n return _isCovariantOf(subType.collection.elementtype, superType.collection.elementtype);\n }\n // Maps/Records are not allowed to be covariant in C#, so we exclude them here\n return false;\n }\n\n // We only support classes for named types\n if (!spec.isNamedTypeReference(subType) || !spec.isNamedTypeReference(superType)) {\n return false;\n }\n\n const subTypeSpec = _dereference(subType.fqn, assembly, validator);\n const superTypeSpec = _dereference(superType.fqn, assembly, validator);\n\n if (!subTypeSpec || !superTypeSpec) {\n return false;\n }\n\n // Handle class-to-class inheritance\n if (spec.isClassType(subTypeSpec) && spec.isClassType(superTypeSpec)) {\n return _classExtendsClass(subTypeSpec, superType.fqn);\n }\n\n // Handle interface-to-interface inheritance\n if (spec.isInterfaceType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {\n return _interfaceExtendsInterface(subTypeSpec, superType.fqn);\n }\n\n // Handle class implementing interface\n if (spec.isClassType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {\n return _classImplementsInterface(subTypeSpec, superType.fqn);\n }\n\n return false;\n }\n\n function _classExtendsClass(classType: spec.ClassType, targetFqn: string): boolean {\n let current = classType;\n while (current.base) {\n if (current.base === targetFqn) {\n return true;\n }\n const baseType = _dereference(current.base, assembly, validator);\n if (!spec.isClassType(baseType)) {\n break;\n }\n current = baseType;\n }\n return false;\n }\n\n function _classImplementsInterface(classType: spec.ClassType, interfaceFqn: string): boolean {\n // Check direct interfaces\n if (classType.interfaces?.includes(interfaceFqn)) {\n return true;\n }\n\n // Check inherited interfaces\n if (classType.interfaces) {\n for (const iface of classType.interfaces) {\n const ifaceType = _dereference(iface, assembly, validator);\n if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, interfaceFqn)) {\n return true;\n }\n }\n }\n\n // Check base class interfaces\n if (classType.base) {\n const baseType = _dereference(classType.base, assembly, validator);\n if (spec.isClassType(baseType)) {\n return _classImplementsInterface(baseType, interfaceFqn);\n }\n }\n\n return false;\n }\n\n function _interfaceExtendsInterface(interfaceType: spec.InterfaceType, targetFqn: string): boolean {\n if (interfaceType.fqn === targetFqn) {\n return true;\n }\n\n if (interfaceType.interfaces) {\n for (const iface of interfaceType.interfaces) {\n if (iface === targetFqn) {\n return true;\n }\n const ifaceType = _dereference(iface, assembly, validator);\n if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, targetFqn)) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n function _assertPropertiesMatch(\n expected: spec.Property,\n actual: spec.Property,\n label: string,\n action: string,\n opts: {\n covariance: boolean;\n },\n ) {\n const actualNode = bindings.getPropertyRelatedNode(actual);\n const expectedNode = bindings.getPropertyRelatedNode(expected);\n if (!!expected.protected !== !!actual.protected) {\n const expVisibility = expected.protected ? 'protected' : 'public';\n const actVisibility = actual.protected ? 'protected' : 'public';\n diagnostic(\n JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(\n actualNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(actualNode),\n label,\n action,\n actVisibility,\n expVisibility,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find(\n (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,\n ) ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n\n // Types must generally be the same, but can be covariant sometimes\n if (!deepEqual(actual.type, expected.type)) {\n if (\n // return type covariance is allowed\n opts.covariance &&\n // static members can never change\n !actual.static &&\n // immutable properties may change in some case, as long as they are covariant\n actual.immutable &&\n _isCovariantOf(actual.type, expected.type)\n ) {\n useFeature('class-covariant-overrides');\n } else {\n diagnostic(\n JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(\n actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.type,\n expected.type,\n ).maybeAddRelatedInformation(\n expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n if (expected.immutable !== actual.immutable) {\n diagnostic(\n JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(\n actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(actualNode),\n label,\n action,\n actual.immutable,\n expected.immutable,\n ).maybeAddRelatedInformation(\n expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??\n declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n if (expected.optional !== actual.optional) {\n diagnostic(\n JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(\n actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),\n label,\n action,\n actual.optional,\n expected.optional,\n ).maybeAddRelatedInformation(\n expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),\n 'The implemented declaration is here.',\n ),\n );\n }\n }\n }\n\n /**\n * Abstract classes that implement an interface should have a declaration for every member.\n *\n * For non-optional members, TypeScript already enforces this. This leaves the user the\n * ability to forget optional properties (`readonly prop?: string`).\n *\n * At least our codegen for this case fails in C#, and I'm not convinced it does the right\n * thing in Java either. So we will disallow this, and require users to declare these\n * fields on the class. It can always be `public abstract readonly prop?: string` if they\n * don't want to give an implementation yet.\n */\n function _abstractClassesMustImplementAllProperties(\n validator: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const type of _allTypes(assembly)) {\n if (!spec.isClassType(type) || !type.abstract) {\n continue;\n }\n\n const classProps = collectClassProps(type, new Set());\n\n for (const implFqn of type.interfaces ?? []) {\n checkInterfacePropsImplemented(implFqn, type, classProps);\n }\n }\n\n /**\n * Return all property names declared on this class and its base classes\n */\n function collectClassProps(type: spec.ClassType, into: Set<string>): Set<string> {\n for (const prop of type.properties ?? []) {\n into.add(prop.name);\n }\n\n if (type.base) {\n const base = _dereference(type.base, assembly, validator);\n if (spec.isClassType(base)) {\n collectClassProps(base, into);\n }\n }\n\n return into;\n }\n\n function checkInterfacePropsImplemented(interfaceFqn: string, cls: spec.ClassType, propNames: Set<string>) {\n const intf = _dereference(interfaceFqn, assembly, validator);\n if (!spec.isInterfaceType(intf)) {\n return;\n }\n\n // We only have to check for optional properties, because anything required\n // would have been caught by the TypeScript compiler already.\n for (const prop of intf.properties ?? []) {\n if (!prop.optional) {\n continue;\n }\n\n if (!propNames.has(prop.name)) {\n diagnostic(\n JsiiDiagnostic.JSII_5021_ABSTRACT_CLASS_MISSING_PROP_IMPL.create(\n bindings.getClassOrInterfaceRelatedNode(cls),\n intf,\n cls,\n prop.name,\n ).maybeAddRelatedInformation(bindings.getPropertyRelatedNode(prop), 'The implemented declaration is here.'),\n );\n }\n }\n\n for (const extFqn of intf.interfaces ?? []) {\n checkInterfacePropsImplemented(extFqn, cls, propNames);\n }\n }\n }\n\n function _staticMembersAndNestedTypesMustNotSharePascalCaseName(\n _: Validator,\n assembly: spec.Assembly,\n diagnostic: DiagnosticEmitter,\n ) {\n for (const nestedType of Object.values(assembly.types ?? {})) {\n if (nestedType.namespace == null) {\n continue;\n }\n const nestingType = assembly.types![`${assembly.name}.${nestedType.namespace}`];\n if (nestingType == null) {\n continue;\n }\n const nestedTypeName = Case.pascal(nestedType.name);\n for (const { name, member } of staticMembers(nestingType)) {\n if (name === nestedTypeName) {\n let diag = JsiiDiagnostic.JSII_5020_STATIC_MEMBER_CONFLICTS_WITH_NESTED_TYPE.create(\n getRelatedNode(member)!,\n nestingType,\n member,\n nestedType,\n );\n const nestedTypeNode = getRelatedNode(nestedType);\n if (nestedTypeNode != null) {\n diag = diag.addRelatedInformation(nestedTypeNode, 'This is the conflicting nested type declaration');\n }\n diagnostic(diag);\n }\n }\n }\n\n function staticMembers(type: spec.Type) {\n if (spec.isClassOrInterfaceType(type)) {\n return [\n ...(type.methods?.filter((method) => method.static) ?? []),\n ...(type.properties?.filter((prop) => prop.static) ?? []),\n ].map((member) => ({ name: Case.pascal(member.name), member }));\n }\n return type.members.map((member) => ({ name: member.name, member }));\n }\n }\n}\n\nfunction _allTypes(assm: spec.Assembly): spec.Type[] {\n return Object.values(assm.types ?? {});\n}\n\nfunction _allMethods(assm: spec.Assembly): Array<{ member: spec.Method; type: spec.Type }> {\n const methods = new Array<{ member: spec.Method; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.methods) {\n continue;\n }\n for (const method of type.methods) methods.push({ member: method, type });\n }\n return methods;\n}\n\nfunction _allProperties(assm: spec.Assembly): Array<{ member: spec.Property; type: spec.Type }> {\n const properties = new Array<{ member: spec.Property; type: spec.Type }>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (!type.properties) {\n continue;\n }\n for (const property of type.properties) properties.push({ member: property, type });\n }\n return properties;\n}\n\nfunction _allMembers(assm: spec.Assembly): Array<{ member: spec.Property | spec.Method; type: spec.Type }> {\n return [..._allMethods(assm), ..._allProperties(assm)];\n}\n\ninterface AnnotatedTypeReference extends spec.NamedTypeReference {\n readonly node: ts.Node | undefined;\n}\n\nfunction _allTypeReferences(assm: spec.Assembly): readonly AnnotatedTypeReference[] {\n const typeReferences = new Array<AnnotatedTypeReference>();\n for (const type of _allTypes(assm)) {\n if (!spec.isClassOrInterfaceType(type)) {\n continue;\n }\n if (spec.isClassType(type)) {\n const node = bindings.getClassRelatedNode(type);\n if (type.base) {\n typeReferences.push({\n fqn: type.base,\n node: node?.heritageClauses?.find((hc) => hc.token === ts.SyntaxKind.ExtendsKeyword)?.types[0],\n });\n }\n if (type.initializer?.parameters) {\n for (const param of type.initializer.parameters) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n }\n if (type.interfaces) {\n const node = bindings.getClassOrInterfaceRelatedNode(type);\n for (const iface of type.interfaces) {\n typeReferences.push({\n fqn: iface,\n node: node?.heritageClauses?.find(\n (hc) =>\n hc.token ===\n (spec.isInterfaceType(type) ? ts.SyntaxKind.ImplementsKeyword : ts.SyntaxKind.ExtendsKeyword),\n ),\n });\n }\n }\n }\n for (const { member: prop } of _allProperties(assm)) {\n _collectTypeReferences(prop.type, bindings.getPropertyRelatedNode(prop)?.type);\n }\n for (const { member: meth } of _allMethods(assm)) {\n if (meth.returns) {\n _collectTypeReferences(meth.returns.type, bindings.getMethodRelatedNode(meth)?.type);\n }\n for (const param of meth.parameters ?? []) {\n _collectTypeReferences(param.type, bindings.getParameterRelatedNode(param)?.type);\n }\n }\n return typeReferences;\n\n function _collectTypeReferences(type: spec.TypeReference, node: ts.Node | undefined): void {\n if (spec.isNamedTypeReference(type)) {\n typeReferences.push({ ...type, node });\n } else if (spec.isCollectionTypeReference(type)) {\n _collectTypeReferences(type.collection.elementtype, node);\n } else if (spec.isUnionTypeReference(type)) {\n for (const t of type.union.types) _collectTypeReferences(t, node);\n }\n }\n}\n\nfunction _dereference(\n typeRef: string | spec.NamedTypeReference,\n assembly: spec.Assembly,\n validator: Validator,\n): spec.Type | undefined {\n if (typeof typeRef !== 'string') {\n typeRef = typeRef.fqn;\n }\n const [assm] = typeRef.split('.');\n if (assembly.name === assm) {\n return assembly.types?.[typeRef];\n }\n const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);\n return foreignAssm?.types?.[typeRef];\n}\n\nfunction _isEmpty(array: undefined | any[]): array is undefined {\n return array == null || array.length === 0;\n}\n\n/**\n * Return whether an identifier only consists of upperchase characters, digits and underscores\n *\n * We have our own check here (isConstantCase) which is more lenient than what\n * `case.constant()` prescribes. We also want to allow combinations of letters\n * and digits without underscores: `C5A`, which `case` would force to `C5_A`.\n * The hint we print will still use `case.constant()` but that is fine.\n */\nfunction isConstantCase(x: string) {\n return !/[^A-Z0-9_]/.exec(x);\n}\n\n/**\n * Obtains the name of the given declaration, if it has one, or returns the declaration itself.\n * This function is meant to be used as a convenience to obtain the `ts.Node` to bind a\n * `JsiiDianostic` instance on.\n *\n * It may return `undefined` but is typed as `ts.Node` so that it is easier to use with\n * `JsiiDiagnostic` factories.\n *\n * @param decl the declaration which name is needed.\n *\n * @returns the name of the declaration if it has one, or the declaration itself. Might return\n * `undefined` if the provided declaration is undefined.\n */\nfunction declarationName(decl: ts.Declaration | ts.Expression | undefined): ts.Node {\n if (decl == null) {\n // Pretend we returned a node - this is used to create diagnostics, worst case it'll be unbound.\n return decl as any;\n }\n return ts.getNameOfDeclaration(decl) ?? decl;\n}\n"]}
package/lib/version.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
2
- export declare const SHORT_VERSION = "5.9.9-dev.3";
2
+ export declare const SHORT_VERSION = "5.9.9-dev.4";
3
3
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION = "5.9.9-dev.3 (build b43ea60)";
4
+ export declare const VERSION = "5.9.9-dev.4 (build b59588f)";
5
5
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
6
6
  export declare const RELEASE_LINE = "5.9";
7
7
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -4,9 +4,9 @@ exports.RELEASE_LINE = exports.VERSION = exports.SHORT_VERSION = void 0;
4
4
  const typescript_1 = require("typescript");
5
5
  // GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!
6
6
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
7
- exports.SHORT_VERSION = '5.9.9-dev.3';
7
+ exports.SHORT_VERSION = '5.9.9-dev.4';
8
8
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION = '5.9.9-dev.3 (build b43ea60)';
9
+ exports.VERSION = '5.9.9-dev.4 (build b59588f)';
10
10
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
11
11
  exports.RELEASE_LINE = typescript_1.versionMajorMinor;
12
12
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,aAAa,CAAC;AAE3C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,6BAA6B,CAAC;AAErD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.9.9-dev.3';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.9-dev.3 (build b43ea60)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,aAAa,CAAC;AAE3C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,6BAA6B,CAAC;AAErD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.9.9-dev.4';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.9-dev.4 (build b59588f)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
package/package.json CHANGED
@@ -92,7 +92,7 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "version": "5.9.9-dev.3",
95
+ "version": "5.9.9-dev.4",
96
96
  "types": "lib/index.d.ts",
97
97
  "exports": {
98
98
  ".": "./lib/index.js",