jsii 5.9.10 → 5.9.11-dev.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.
- package/SUPPORT.md +12 -12
- package/lib/type-analysis.d.ts +11 -0
- package/lib/type-analysis.js +123 -0
- package/lib/type-analysis.js.map +1 -0
- package/lib/type-reference.d.ts +10 -0
- package/lib/type-reference.js +23 -0
- package/lib/type-reference.js.map +1 -1
- package/lib/validator.js +15 -139
- package/lib/validator.js.map +1 -1
- package/lib/version.d.ts +2 -2
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
package/SUPPORT.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
# Maintenance & Support Policy
|
|
2
2
|
|
|
3
3
|
This document describes the Maintenance & Support Policy applicable to releases
|
|
4
4
|
of the `jsii` compiler ([`npm:jsii`](https://npmjs.com/packages/jsii)) with
|
|
5
5
|
versions `5.0.x` and newer.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Versioning Scheme
|
|
8
8
|
|
|
9
9
|
In-scope `jsii` release lines use the same `major.minor` version as the
|
|
10
10
|
TypeScript compiler ([`npm:typescript`](https://npmjs.com/packages/typescript))
|
|
@@ -12,7 +12,7 @@ they are built with. This means that `jsii@5.0.x` is built on top of
|
|
|
12
12
|
`typescript@5.0.x`.
|
|
13
13
|
|
|
14
14
|
Since the `typescript` package does not follow [Semantic Versioning][semver],
|
|
15
|
-
the `jsii` package does not
|
|
15
|
+
the `jsii` package does not either. The `typescript` compiler guarantees no
|
|
16
16
|
breaking change is introduced within a given `major.minor` release line, and
|
|
17
17
|
`jsii` upholds the same guarantee. As a consequence, users are advised to use
|
|
18
18
|
`~` ranges (also referred to as minor-pinned ranges) when declaring dependencies
|
|
@@ -24,7 +24,7 @@ is issued).
|
|
|
24
24
|
|
|
25
25
|
[semver]: https://semver.org
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Release Lines Lifecycle Stages
|
|
28
28
|
|
|
29
29
|
This Maintenance & Support Policy assigns one of the following lifecycle stages
|
|
30
30
|
to each in-scope `jsii` release line in existence:
|
|
@@ -33,7 +33,7 @@ to each in-scope `jsii` release line in existence:
|
|
|
33
33
|
the release under active development, receiving new features, bug fixes and
|
|
34
34
|
security updates.
|
|
35
35
|
|
|
36
|
-
1. **
|
|
36
|
+
1. **Maintenance**: Release lines in **Maintenance** stage are no longer
|
|
37
37
|
considered in active development, and no new features will be added to these.
|
|
38
38
|
They however continue to receive bug fixes and security updates. Users can
|
|
39
39
|
continue to use release lines in **Maintenance** stage indefinitely, but we
|
|
@@ -47,7 +47,7 @@ to each in-scope `jsii` release line in existence:
|
|
|
47
47
|
changes in newer releases at any time. Users are advised to migrate away from
|
|
48
48
|
**End-of-Support** release lines at the earliest convenience.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
## Stage Transitions
|
|
51
51
|
|
|
52
52
|
```mermaid
|
|
53
53
|
---
|
|
@@ -66,7 +66,7 @@ stateDiagram-v2
|
|
|
66
66
|
|
|
67
67
|
Whenever a new release line is started (typically with a new `x.y.0` release,
|
|
68
68
|
excluding pre-releases), it becomes **Current** and the release line it replaced
|
|
69
|
-
immediately enters the **
|
|
69
|
+
immediately enters the **Maintenance** stage.
|
|
70
70
|
|
|
71
71
|
Releases stay in the **Maintenance** stage for a minimum of 6 months before they
|
|
72
72
|
reach **End-of-Support**.
|
|
@@ -74,7 +74,7 @@ reach **End-of-Support**.
|
|
|
74
74
|
Once a release line has reached **End-of-Support**, it remains in this stage
|
|
75
75
|
indefinitely.
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
## Timelines & Communication
|
|
78
78
|
|
|
79
79
|
The `typescript` compiler maintainers start a new release line on a quarterly
|
|
80
80
|
basis, and users should expect the `jsii` compiler maintainers to do the same.
|
|
@@ -99,7 +99,7 @@ manifest document.
|
|
|
99
99
|
The current status of `jsii` compiler release lines is also documented on the
|
|
100
100
|
[repository's `README.md` document][readme].
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
## Modification
|
|
103
103
|
|
|
104
104
|
The maintainers of the jsii project reserve the right to modify this Maintenance
|
|
105
105
|
and Support Policy as necessary. Updates will be proposed by way of a pull
|
|
@@ -108,13 +108,13 @@ timeline of release lines will be broadly announced to the community via
|
|
|
108
108
|
established communication channels (such as the `cdk.dev` Slack), and will
|
|
109
109
|
remain open for the community to comment on for a minimum of 15 days.
|
|
110
110
|
|
|
111
|
-
Community members are welcome to propose changes to the support and
|
|
111
|
+
Community members are welcome to propose changes to the support and maintenance
|
|
112
112
|
policy through the same process.
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
## Derogation
|
|
115
115
|
|
|
116
116
|
Under _exceptional_ circumstances, the project maintainers may elect to derogate
|
|
117
|
-
from this Support & Maintenance Policy. In cases where the
|
|
117
|
+
from this Support & Maintenance Policy. In cases where the decision to
|
|
118
118
|
derogate extends supplemental maintenance & support coverage for a release line,
|
|
119
119
|
the increased coverage will be documented in the
|
|
120
120
|
[repository's `README.md` document][readme].
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as spec from '@jsii/spec';
|
|
2
|
+
import { TypeResolver } from './type-reference';
|
|
3
|
+
/**
|
|
4
|
+
* Check if subType is an allowed covariant subtype to superType
|
|
5
|
+
*
|
|
6
|
+
* This is not a generic check for subtypes or covariance, but a specific implementation
|
|
7
|
+
* that checks the currently allowed conditions for class covariance.
|
|
8
|
+
* In practice, this is driven by C# limitations.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isAllowedCovariantSubtype(subType: spec.TypeReference | undefined, superType: spec.TypeReference | undefined, dereference: TypeResolver): boolean;
|
|
11
|
+
//# sourceMappingURL=type-analysis.d.ts.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAllowedCovariantSubtype = isAllowedCovariantSubtype;
|
|
4
|
+
const spec = require("@jsii/spec");
|
|
5
|
+
const deepEqual = require("fast-deep-equal");
|
|
6
|
+
/**
|
|
7
|
+
* Check if subType is an allowed covariant subtype to superType
|
|
8
|
+
*
|
|
9
|
+
* This is not a generic check for subtypes or covariance, but a specific implementation
|
|
10
|
+
* that checks the currently allowed conditions for class covariance.
|
|
11
|
+
* In practice, this is driven by C# limitations.
|
|
12
|
+
*/
|
|
13
|
+
function isAllowedCovariantSubtype(subType, superType, dereference) {
|
|
14
|
+
// one void, while other isn't => not covariant
|
|
15
|
+
if ((subType === undefined) !== (superType === undefined)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
// Same type is always covariant
|
|
19
|
+
if (deepEqual(subType, superType)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
// Handle array collections (covariant)
|
|
23
|
+
if (spec.isCollectionTypeReference(subType) && spec.isCollectionTypeReference(superType)) {
|
|
24
|
+
if (subType.collection.kind === 'array' && superType.collection.kind === 'array') {
|
|
25
|
+
return isAllowedCovariantSubtype(subType.collection.elementtype, superType.collection.elementtype, dereference);
|
|
26
|
+
}
|
|
27
|
+
// Maps are not allowed to be covariant in C#, so we exclude them here.
|
|
28
|
+
// This seems to be because we use C# Dictionary to implements Maps, which are using generics and generics are not allowed to be covariant
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
// Union types are currently not allowed, because we have not seen the need for it.
|
|
32
|
+
// Technically narrowing (removing `| Type` or subtyping) could be allowed and this works in C#.
|
|
33
|
+
if (spec.isUnionTypeReference(subType) || spec.isUnionTypeReference(superType)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
// Intersection types are invalid, because intersections are only allowed as inputs
|
|
37
|
+
// and covariance is only allowed in outputs.
|
|
38
|
+
if (spec.isIntersectionTypeReference(subType) || spec.isIntersectionTypeReference(superType)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// Primitives can never be covariant to each other in C#
|
|
42
|
+
if (spec.isPrimitiveTypeReference(subType) || spec.isPrimitiveTypeReference(superType)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
// We really only support covariance for named types (and lists of named types).
|
|
46
|
+
// To be safe, let's guard against any unknown cases.
|
|
47
|
+
if (!spec.isNamedTypeReference(subType) || !spec.isNamedTypeReference(superType)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const subTypeSpec = dereference(subType.fqn);
|
|
51
|
+
const superTypeSpec = dereference(superType.fqn);
|
|
52
|
+
if (!subTypeSpec || !superTypeSpec) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// Handle class-to-class inheritance
|
|
56
|
+
if (spec.isClassType(subTypeSpec) && spec.isClassType(superTypeSpec)) {
|
|
57
|
+
return _classExtendsClass(subTypeSpec, superType.fqn);
|
|
58
|
+
}
|
|
59
|
+
// Handle interface-to-interface inheritance
|
|
60
|
+
if (spec.isInterfaceType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {
|
|
61
|
+
return _interfaceExtendsInterface(subTypeSpec, superType.fqn);
|
|
62
|
+
}
|
|
63
|
+
// Handle class implementing interface
|
|
64
|
+
if (spec.isClassType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {
|
|
65
|
+
return _classImplementsInterface(subTypeSpec, superType.fqn);
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
function _classExtendsClass(classType, targetFqn) {
|
|
69
|
+
let current = classType;
|
|
70
|
+
while (current.base) {
|
|
71
|
+
if (current.base === targetFqn) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const baseType = dereference(current.base);
|
|
75
|
+
if (!spec.isClassType(baseType)) {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
current = baseType;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function _classImplementsInterface(classType, interfaceFqn) {
|
|
83
|
+
// Check direct interfaces
|
|
84
|
+
if (classType.interfaces?.includes(interfaceFqn)) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
// Check inherited interfaces
|
|
88
|
+
if (classType.interfaces) {
|
|
89
|
+
for (const iface of classType.interfaces) {
|
|
90
|
+
const ifaceType = dereference(iface);
|
|
91
|
+
if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, interfaceFqn)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Check base class interfaces
|
|
97
|
+
if (classType.base) {
|
|
98
|
+
const baseType = dereference(classType.base);
|
|
99
|
+
if (spec.isClassType(baseType)) {
|
|
100
|
+
return _classImplementsInterface(baseType, interfaceFqn);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
function _interfaceExtendsInterface(interfaceType, targetFqn) {
|
|
106
|
+
if (interfaceType.fqn === targetFqn) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (interfaceType.interfaces) {
|
|
110
|
+
for (const iface of interfaceType.interfaces) {
|
|
111
|
+
if (iface === targetFqn) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
const ifaceType = dereference(iface);
|
|
115
|
+
if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, targetFqn)) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=type-analysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-analysis.js","sourceRoot":"","sources":["../src/type-analysis.ts"],"names":[],"mappings":";;AAWA,8DAqIC;AAhJD,mCAAmC;AACnC,6CAA6C;AAG7C;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,OAAuC,EACvC,SAAyC,EACzC,WAAyB;IAEzB,+CAA+C;IAC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,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;gBACrC,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;oBACxF,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import * as spec from '@jsii/spec';\nimport * as deepEqual from 'fast-deep-equal';\nimport { TypeResolver } from './type-reference';\n\n/**\n * Check if subType is an allowed covariant subtype to superType\n *\n * This is not a generic check for subtypes or covariance, but a specific implementation\n * that checks the currently allowed conditions for class covariance.\n * In practice, this is driven by C# limitations.\n */\nexport function isAllowedCovariantSubtype(\n subType: spec.TypeReference | undefined,\n superType: spec.TypeReference | undefined,\n dereference: TypeResolver,\n): 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 isAllowedCovariantSubtype(subType.collection.elementtype, superType.collection.elementtype, dereference);\n }\n // Maps are not allowed to be covariant in C#, so we exclude them here.\n // This seems to be because we use C# Dictionary to implements Maps, which are using generics and generics are not allowed to be covariant\n return false;\n }\n\n // Union types are currently not allowed, because we have not seen the need for it.\n // Technically narrowing (removing `| Type` or subtyping) could be allowed and this works in C#.\n if (spec.isUnionTypeReference(subType) || spec.isUnionTypeReference(superType)) {\n return false;\n }\n\n // Intersection types are invalid, because intersections are only allowed as inputs\n // and covariance is only allowed in outputs.\n if (spec.isIntersectionTypeReference(subType) || spec.isIntersectionTypeReference(superType)) {\n return false;\n }\n\n // Primitives can never be covariant to each other in C#\n if (spec.isPrimitiveTypeReference(subType) || spec.isPrimitiveTypeReference(superType)) {\n return false;\n }\n\n // We really only support covariance for named types (and lists of named types).\n // To be safe, let's guard against any unknown cases.\n if (!spec.isNamedTypeReference(subType) || !spec.isNamedTypeReference(superType)) {\n return false;\n }\n\n const subTypeSpec = dereference(subType.fqn);\n const superTypeSpec = dereference(superType.fqn);\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 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);\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);\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);\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);\n if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, targetFqn)) {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n"]}
|
package/lib/type-reference.d.ts
CHANGED
|
@@ -7,4 +7,14 @@ export declare function typeReferenceToString(x: spec.TypeReference): string;
|
|
|
7
7
|
* Return whether the given type references are equal
|
|
8
8
|
*/
|
|
9
9
|
export declare function typeReferenceEqual(a: spec.TypeReference, b: spec.TypeReference): boolean;
|
|
10
|
+
export type TypeResolver = (typeRef: string | spec.NamedTypeReference) => spec.Type | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a type resolver function for a given context (assembly + dependency closure).
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTypeResolver(assembly: spec.Assembly, dependencyClosure: readonly spec.Assembly[]): TypeResolver;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a type from a name to the actual type.
|
|
17
|
+
* Uses a given assembly and dependency closure for lookup.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveType(typeRef: string | spec.NamedTypeReference, assembly: spec.Assembly, dependencyClosure: readonly spec.Assembly[]): spec.Type | undefined;
|
|
10
20
|
//# sourceMappingURL=type-reference.d.ts.map
|
package/lib/type-reference.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.typeReferenceToString = typeReferenceToString;
|
|
4
4
|
exports.typeReferenceEqual = typeReferenceEqual;
|
|
5
|
+
exports.createTypeResolver = createTypeResolver;
|
|
6
|
+
exports.resolveType = resolveType;
|
|
5
7
|
const spec = require("@jsii/spec");
|
|
6
8
|
const type_visitor_1 = require("./type-visitor");
|
|
7
9
|
/**
|
|
@@ -49,4 +51,25 @@ function typeReferenceEqual(a, b) {
|
|
|
49
51
|
}
|
|
50
52
|
return false;
|
|
51
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates a type resolver function for a given context (assembly + dependency closure).
|
|
56
|
+
*/
|
|
57
|
+
function createTypeResolver(assembly, dependencyClosure) {
|
|
58
|
+
return (typeRef) => resolveType(typeRef, assembly, dependencyClosure);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a type from a name to the actual type.
|
|
62
|
+
* Uses a given assembly and dependency closure for lookup.
|
|
63
|
+
*/
|
|
64
|
+
function resolveType(typeRef, assembly, dependencyClosure) {
|
|
65
|
+
if (typeof typeRef !== 'string') {
|
|
66
|
+
typeRef = typeRef.fqn;
|
|
67
|
+
}
|
|
68
|
+
const [assm] = typeRef.split('.');
|
|
69
|
+
if (assembly.name === assm) {
|
|
70
|
+
return assembly.types?.[typeRef];
|
|
71
|
+
}
|
|
72
|
+
const foreignAssm = dependencyClosure.find((dep) => dep.name === assm);
|
|
73
|
+
return foreignAssm?.types?.[typeRef];
|
|
74
|
+
}
|
|
52
75
|
//# sourceMappingURL=type-reference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-reference.js","sourceRoot":"","sources":["../src/type-reference.ts"],"names":[],"mappings":";;AAMA,sDAkBC;AAKD,gDAyBC;
|
|
1
|
+
{"version":3,"file":"type-reference.js","sourceRoot":"","sources":["../src/type-reference.ts"],"names":[],"mappings":";;AAMA,sDAkBC;AAKD,gDAyBC;AAOD,gDAEC;AAMD,kCAcC;AAnFD,mCAAmC;AACnC,iDAAoD;AAEpD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,CAAqB;IACzD,OAAO,IAAA,iCAAkB,EAAS,CAAC,EAAE;QACnC,KAAK,EAAE,UAAU,GAA4B;YAC3C,OAAO,GAAG,CAAC,GAAG,CAAC;QACjB,CAAC;QACD,SAAS,EAAE,UAAU,GAAgC;YACnD,OAAO,GAAG,CAAC,SAAS,CAAC;QACvB,CAAC;QACD,UAAU,EAAE,UAAU,GAAiC;Y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AK,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,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACvE,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import * as spec from '@jsii/spec';\nimport { visitTypeReference } from './type-visitor';\n\n/**\n * Convert a type reference to a string\n */\nexport function typeReferenceToString(x: spec.TypeReference): string {\n return visitTypeReference<string>(x, {\n named: function (ref: spec.NamedTypeReference) {\n return ref.fqn;\n },\n primitive: function (ref: spec.PrimitiveTypeReference) {\n return ref.primitive;\n },\n collection: function (ref: spec.CollectionTypeReference) {\n return `${ref.collection.kind}<${typeReferenceToString(ref.collection.elementtype)}>`;\n },\n union: function (ref: spec.UnionTypeReference) {\n return ref.union.types.map(typeReferenceToString).join(' | ');\n },\n intersection: function (ref: spec.IntersectionTypeReference) {\n return ref.intersection.types.map(typeReferenceToString).join(' & ');\n },\n });\n}\n\n/**\n * Return whether the given type references are equal\n */\nexport function typeReferenceEqual(a: spec.TypeReference, b: spec.TypeReference): boolean {\n if (spec.isNamedTypeReference(a) && spec.isNamedTypeReference(b)) {\n return a.fqn === b.fqn;\n }\n if (spec.isPrimitiveTypeReference(a) && spec.isPrimitiveTypeReference(b)) {\n return a.primitive === b.primitive;\n }\n if (spec.isCollectionTypeReference(a) && spec.isCollectionTypeReference(b)) {\n return (\n a.collection.kind === b.collection.kind && typeReferenceEqual(a.collection.elementtype, b.collection.elementtype)\n );\n }\n if (spec.isUnionTypeReference(a) && spec.isUnionTypeReference(b)) {\n return (\n a.union.types.length === b.union.types.length &&\n a.union.types.every((aType, i) => typeReferenceEqual(aType, b.union.types[i]))\n );\n }\n if (spec.isIntersectionTypeReference(a) && spec.isIntersectionTypeReference(b)) {\n return (\n a.intersection.types.length === b.intersection.types.length &&\n a.intersection.types.every((aType, i) => typeReferenceEqual(aType, b.intersection.types[i]))\n );\n }\n return false;\n}\n\nexport type TypeResolver = (typeRef: string | spec.NamedTypeReference) => spec.Type | undefined;\n\n/**\n * Creates a type resolver function for a given context (assembly + dependency closure).\n */\nexport function createTypeResolver(assembly: spec.Assembly, dependencyClosure: readonly spec.Assembly[]): TypeResolver {\n return (typeRef) => resolveType(typeRef, assembly, dependencyClosure);\n}\n\n/**\n * Resolve a type from a name to the actual type.\n * Uses a given assembly and dependency closure for lookup.\n */\nexport function resolveType(\n typeRef: string | spec.NamedTypeReference,\n assembly: spec.Assembly,\n dependencyClosure: readonly spec.Assembly[],\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 = dependencyClosure.find((dep) => dep.name === assm);\n return foreignAssm?.types?.[typeRef];\n}\n"]}
|
package/lib/validator.js
CHANGED
|
@@ -9,6 +9,8 @@ const Case = require("./case");
|
|
|
9
9
|
const jsii_diagnostic_1 = require("./jsii-diagnostic");
|
|
10
10
|
const node_bindings_1 = require("./node-bindings");
|
|
11
11
|
const bindings = require("./node-bindings");
|
|
12
|
+
const type_analysis_1 = require("./type-analysis");
|
|
13
|
+
const type_reference_1 = require("./type-reference");
|
|
12
14
|
class Validator {
|
|
13
15
|
constructor(projectInfo, assembly) {
|
|
14
16
|
this.projectInfo = projectInfo;
|
|
@@ -110,6 +112,7 @@ function _defaultValidations() {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
function _inheritanceDoesNotChangeContracts(validator, assembly, diagnostic, useFeature) {
|
|
115
|
+
const _dereference = (0, type_reference_1.createTypeResolver)(assembly, validator.projectInfo.dependencyClosure);
|
|
113
116
|
for (const type of _allTypes(assembly)) {
|
|
114
117
|
if (spec.isClassType(type)) {
|
|
115
118
|
for (const method of type.methods ?? []) {
|
|
@@ -149,7 +152,7 @@ function _defaultValidations() {
|
|
|
149
152
|
}
|
|
150
153
|
if (spec.isClassType(type) && type.base) {
|
|
151
154
|
// We have a parent class, collect their concrete members, too (recursively)...
|
|
152
|
-
const base = _dereference(type.base
|
|
155
|
+
const base = _dereference(type.base);
|
|
153
156
|
assert(base != null && spec.isClassType(base));
|
|
154
157
|
for (const member of _allImplementations(base, getter)) {
|
|
155
158
|
if (known.has(member.name)) {
|
|
@@ -177,7 +180,7 @@ function _defaultValidations() {
|
|
|
177
180
|
if (!type.base) {
|
|
178
181
|
return false;
|
|
179
182
|
}
|
|
180
|
-
const baseType = _dereference(type.base
|
|
183
|
+
const baseType = _dereference(type.base);
|
|
181
184
|
if (!baseType) {
|
|
182
185
|
return false;
|
|
183
186
|
}
|
|
@@ -195,7 +198,7 @@ function _defaultValidations() {
|
|
|
195
198
|
if (!type.base) {
|
|
196
199
|
return false;
|
|
197
200
|
}
|
|
198
|
-
const baseType = _dereference(type.base
|
|
201
|
+
const baseType = _dereference(type.base);
|
|
199
202
|
if (!baseType) {
|
|
200
203
|
return false;
|
|
201
204
|
}
|
|
@@ -213,12 +216,12 @@ function _defaultValidations() {
|
|
|
213
216
|
if (!type.interfaces) {
|
|
214
217
|
// Abstract classes may not directly implement all members, need to check their supertypes...
|
|
215
218
|
if (spec.isClassType(type) && type.base && type.abstract) {
|
|
216
|
-
return _validateMethodImplementation(method, _dereference(type.base
|
|
219
|
+
return _validateMethodImplementation(method, _dereference(type.base));
|
|
217
220
|
}
|
|
218
221
|
return false;
|
|
219
222
|
}
|
|
220
223
|
for (const iface of type.interfaces) {
|
|
221
|
-
const ifaceType = _dereference(iface
|
|
224
|
+
const ifaceType = _dereference(iface);
|
|
222
225
|
const implemented = (ifaceType.methods ?? []).find((m) => m.name === method.name);
|
|
223
226
|
if (implemented) {
|
|
224
227
|
_assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`, {
|
|
@@ -239,12 +242,12 @@ function _defaultValidations() {
|
|
|
239
242
|
if (!type.interfaces) {
|
|
240
243
|
// Abstract classes may not directly implement all members, need to check their supertypes...
|
|
241
244
|
if (spec.isClassType(type) && type.base && type.abstract) {
|
|
242
|
-
return _validatePropertyImplementation(property, _dereference(type.base
|
|
245
|
+
return _validatePropertyImplementation(property, _dereference(type.base));
|
|
243
246
|
}
|
|
244
247
|
return false;
|
|
245
248
|
}
|
|
246
249
|
for (const iface of type.interfaces) {
|
|
247
|
-
const ifaceType = _dereference(iface
|
|
250
|
+
const ifaceType = _dereference(iface);
|
|
248
251
|
const implemented = (ifaceType.properties ?? []).find((p) => p.name === property.name);
|
|
249
252
|
if (implemented) {
|
|
250
253
|
_assertPropertiesMatch(implemented, property, `${type.fqn}#${property.name}`, `implementing ${ifaceType.fqn}`, { allowCovariance: false });
|
|
@@ -275,7 +278,7 @@ function _defaultValidations() {
|
|
|
275
278
|
// static members can never change
|
|
276
279
|
!actual.static &&
|
|
277
280
|
// this is a valid covariant return type (actual is more specific than expected)
|
|
278
|
-
|
|
281
|
+
(0, type_analysis_1.isAllowedCovariantSubtype)(actualReturnType, expectedReturnType, _dereference)) {
|
|
279
282
|
useFeature('class-covariant-overrides');
|
|
280
283
|
}
|
|
281
284
|
else {
|
|
@@ -305,123 +308,6 @@ function _defaultValidations() {
|
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
}
|
|
308
|
-
/**
|
|
309
|
-
* Check if subType is an allowed covariant subtype to superType
|
|
310
|
-
*
|
|
311
|
-
* This is not a generic check for subtypes or covariance, but a specific implementation
|
|
312
|
-
* that checks the currently allowed conditions for class covariance.
|
|
313
|
-
* In practice, this is driven by C# limitations.
|
|
314
|
-
*/
|
|
315
|
-
function _isAllowedCovariantSubtype(subType, superType) {
|
|
316
|
-
// one void, while other isn't => not covariant
|
|
317
|
-
if ((subType === undefined) !== (superType === undefined)) {
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
// Same type is always covariant
|
|
321
|
-
if (deepEqual(subType, superType)) {
|
|
322
|
-
return true;
|
|
323
|
-
}
|
|
324
|
-
// Handle array collections (covariant)
|
|
325
|
-
if (spec.isCollectionTypeReference(subType) && spec.isCollectionTypeReference(superType)) {
|
|
326
|
-
if (subType.collection.kind === 'array' && superType.collection.kind === 'array') {
|
|
327
|
-
return _isAllowedCovariantSubtype(subType.collection.elementtype, superType.collection.elementtype);
|
|
328
|
-
}
|
|
329
|
-
// Maps are not allowed to be covariant in C#, so we exclude them here.
|
|
330
|
-
// This seems to be because we use C# Dictionary to implements Maps, which are using generics and generics are not allowed to be covariant
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
// Union types are currently not allowed, because we have not seen the need for it.
|
|
334
|
-
// Technically narrowing (removing `| Type` or subtyping) could be allowed and this works in C#.
|
|
335
|
-
if (spec.isUnionTypeReference(subType) || spec.isUnionTypeReference(superType)) {
|
|
336
|
-
return false;
|
|
337
|
-
}
|
|
338
|
-
// Intersection types are invalid, because intersections are only allowed as inputs
|
|
339
|
-
// and covariance is only allowed in outputs.
|
|
340
|
-
if (spec.isIntersectionTypeReference(subType) || spec.isIntersectionTypeReference(superType)) {
|
|
341
|
-
return false;
|
|
342
|
-
}
|
|
343
|
-
// Primitives can never be covariant to each other in C#
|
|
344
|
-
if (spec.isPrimitiveTypeReference(subType) || spec.isPrimitiveTypeReference(superType)) {
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
// We really only support covariance for named types (and lists of named types).
|
|
348
|
-
// To be safe, let's guard against any unknown cases.
|
|
349
|
-
if (!spec.isNamedTypeReference(subType) || !spec.isNamedTypeReference(superType)) {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
const subTypeSpec = _dereference(subType.fqn, assembly, validator);
|
|
353
|
-
const superTypeSpec = _dereference(superType.fqn, assembly, validator);
|
|
354
|
-
if (!subTypeSpec || !superTypeSpec) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
// Handle class-to-class inheritance
|
|
358
|
-
if (spec.isClassType(subTypeSpec) && spec.isClassType(superTypeSpec)) {
|
|
359
|
-
return _classExtendsClass(subTypeSpec, superType.fqn);
|
|
360
|
-
}
|
|
361
|
-
// Handle interface-to-interface inheritance
|
|
362
|
-
if (spec.isInterfaceType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {
|
|
363
|
-
return _interfaceExtendsInterface(subTypeSpec, superType.fqn);
|
|
364
|
-
}
|
|
365
|
-
// Handle class implementing interface
|
|
366
|
-
if (spec.isClassType(subTypeSpec) && spec.isInterfaceType(superTypeSpec)) {
|
|
367
|
-
return _classImplementsInterface(subTypeSpec, superType.fqn);
|
|
368
|
-
}
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
function _classExtendsClass(classType, targetFqn) {
|
|
372
|
-
let current = classType;
|
|
373
|
-
while (current.base) {
|
|
374
|
-
if (current.base === targetFqn) {
|
|
375
|
-
return true;
|
|
376
|
-
}
|
|
377
|
-
const baseType = _dereference(current.base, assembly, validator);
|
|
378
|
-
if (!spec.isClassType(baseType)) {
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
current = baseType;
|
|
382
|
-
}
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
function _classImplementsInterface(classType, interfaceFqn) {
|
|
386
|
-
// Check direct interfaces
|
|
387
|
-
if (classType.interfaces?.includes(interfaceFqn)) {
|
|
388
|
-
return true;
|
|
389
|
-
}
|
|
390
|
-
// Check inherited interfaces
|
|
391
|
-
if (classType.interfaces) {
|
|
392
|
-
for (const iface of classType.interfaces) {
|
|
393
|
-
const ifaceType = _dereference(iface, assembly, validator);
|
|
394
|
-
if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, interfaceFqn)) {
|
|
395
|
-
return true;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
// Check base class interfaces
|
|
400
|
-
if (classType.base) {
|
|
401
|
-
const baseType = _dereference(classType.base, assembly, validator);
|
|
402
|
-
if (spec.isClassType(baseType)) {
|
|
403
|
-
return _classImplementsInterface(baseType, interfaceFqn);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return false;
|
|
407
|
-
}
|
|
408
|
-
function _interfaceExtendsInterface(interfaceType, targetFqn) {
|
|
409
|
-
if (interfaceType.fqn === targetFqn) {
|
|
410
|
-
return true;
|
|
411
|
-
}
|
|
412
|
-
if (interfaceType.interfaces) {
|
|
413
|
-
for (const iface of interfaceType.interfaces) {
|
|
414
|
-
if (iface === targetFqn) {
|
|
415
|
-
return true;
|
|
416
|
-
}
|
|
417
|
-
const ifaceType = _dereference(iface, assembly, validator);
|
|
418
|
-
if (spec.isInterfaceType(ifaceType) && _interfaceExtendsInterface(ifaceType, targetFqn)) {
|
|
419
|
-
return true;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
311
|
function _assertPropertiesMatch(expected, actual, label, action, opts) {
|
|
426
312
|
const actualNode = bindings.getPropertyRelatedNode(actual);
|
|
427
313
|
const expectedNode = bindings.getPropertyRelatedNode(expected);
|
|
@@ -439,7 +325,7 @@ function _defaultValidations() {
|
|
|
439
325
|
!actual.static &&
|
|
440
326
|
// immutable properties may change in some case, as long as they are covariant
|
|
441
327
|
actual.immutable &&
|
|
442
|
-
|
|
328
|
+
(0, type_analysis_1.isAllowedCovariantSubtype)(actual.type, expected.type, _dereference)) {
|
|
443
329
|
useFeature('class-covariant-overrides');
|
|
444
330
|
}
|
|
445
331
|
else {
|
|
@@ -468,6 +354,7 @@ function _defaultValidations() {
|
|
|
468
354
|
* don't want to give an implementation yet.
|
|
469
355
|
*/
|
|
470
356
|
function _abstractClassesMustImplementAllProperties(validator, assembly, diagnostic) {
|
|
357
|
+
const _dereference = (0, type_reference_1.createTypeResolver)(assembly, validator.projectInfo.dependencyClosure);
|
|
471
358
|
for (const type of _allTypes(assembly)) {
|
|
472
359
|
if (!spec.isClassType(type) || !type.abstract) {
|
|
473
360
|
continue;
|
|
@@ -485,7 +372,7 @@ function _defaultValidations() {
|
|
|
485
372
|
into.add(prop.name);
|
|
486
373
|
}
|
|
487
374
|
if (type.base) {
|
|
488
|
-
const base = _dereference(type.base
|
|
375
|
+
const base = _dereference(type.base);
|
|
489
376
|
if (spec.isClassType(base)) {
|
|
490
377
|
collectClassProps(base, into);
|
|
491
378
|
}
|
|
@@ -493,7 +380,7 @@ function _defaultValidations() {
|
|
|
493
380
|
return into;
|
|
494
381
|
}
|
|
495
382
|
function checkInterfacePropsImplemented(interfaceFqn, cls, propNames) {
|
|
496
|
-
const intf = _dereference(interfaceFqn
|
|
383
|
+
const intf = _dereference(interfaceFqn);
|
|
497
384
|
if (!spec.isInterfaceType(intf)) {
|
|
498
385
|
return;
|
|
499
386
|
}
|
|
@@ -634,17 +521,6 @@ function _allTypeReferences(assm) {
|
|
|
634
521
|
}
|
|
635
522
|
}
|
|
636
523
|
}
|
|
637
|
-
function _dereference(typeRef, assembly, validator) {
|
|
638
|
-
if (typeof typeRef !== 'string') {
|
|
639
|
-
typeRef = typeRef.fqn;
|
|
640
|
-
}
|
|
641
|
-
const [assm] = typeRef.split('.');
|
|
642
|
-
if (assembly.name === assm) {
|
|
643
|
-
return assembly.types?.[typeRef];
|
|
644
|
-
}
|
|
645
|
-
const foreignAssm = validator.projectInfo.dependencyClosure.find((dep) => dep.name === assm);
|
|
646
|
-
return foreignAssm?.types?.[typeRef];
|
|
647
|
-
}
|
|
648
524
|
function _isEmpty(array) {
|
|
649
525
|
return array == null || array.length === 0;
|
|
650
526
|
}
|
package/lib/validator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,m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'@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 allowReturnTypeCovariance: 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 allowCovariance: 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 allowReturnTypeCovariance: 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 { allowCovariance: 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 allowReturnTypeCovariance: 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.allowReturnTypeCovariance &&\n // static members can never change\n !actual.static &&\n // this is a valid covariant return type (actual is more specific than expected)\n _isAllowedCovariantSubtype(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 an allowed covariant subtype to superType\n *\n * This is not a generic check for subtypes or covariance, but a specific implementation\n * that checks the currently allowed conditions for class covariance.\n * In practice, this is driven by C# limitations.\n */\n function _isAllowedCovariantSubtype(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 _isAllowedCovariantSubtype(subType.collection.elementtype, superType.collection.elementtype);\n }\n // Maps are not allowed to be covariant in C#, so we exclude them here.\n // This seems to be because we use C# Dictionary to implements Maps, which are using generics and generics are not allowed to be covariant\n return false;\n }\n\n // Union types are currently not allowed, because we have not seen the need for it.\n // Technically narrowing (removing `| Type` or subtyping) could be allowed and this works in C#.\n if (spec.isUnionTypeReference(subType) || spec.isUnionTypeReference(superType)) {\n return false;\n }\n\n // Intersection types are invalid, because intersections are only allowed as inputs\n // and covariance is only allowed in outputs.\n if (spec.isIntersectionTypeReference(subType) || spec.isIntersectionTypeReference(superType)) {\n return false;\n }\n\n // Primitives can never be covariant to each other in C#\n if (spec.isPrimitiveTypeReference(subType) || spec.isPrimitiveTypeReference(superType)) {\n return false;\n }\n\n // We really only support covariance for named types (and lists of named types).\n // To be safe, let's guard against any unknown cases.\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 allowCovariance: 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.allowCovariance &&\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 _isAllowedCovariantSubtype(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;AACtC,mCAAmC;AACnC,6CAA6C;AAC7C,iCAAiC;AACjC,+BAA+B;AAE/B,uDAAmD;AACnD,mDAAiD;AACjD,4CAA4C;AAE5C,mDAA4D;AAC5D,qDAAsD;AAMtD,MAAa,SAAS;IAGpB,YAAm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C,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;IACD,OAAO,cAAc,CAAC;IAEtB,SAAS,sBAAsB,CAAC,IAAwB,EAAE,IAAyB;QACjF,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,cAAc,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC;aAAM,IAAI,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC;aAAM,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;gBAAE,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,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';\nimport { isAllowedCovariantSubtype } from './type-analysis';\nimport { createTypeResolver } from './type-reference';\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 const _dereference = createTypeResolver(assembly, validator.projectInfo.dependencyClosure);\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);\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) 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 allowReturnTypeCovariance: 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) 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 allowCovariance: 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) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface) 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 allowReturnTypeCovariance: 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(property, _dereference(type.base) as spec.ClassType);\n }\n return false;\n }\n for (const iface of type.interfaces) {\n const ifaceType = _dereference(iface) 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 { allowCovariance: 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 allowReturnTypeCovariance: 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.allowReturnTypeCovariance &&\n // static members can never change\n !actual.static &&\n // this is a valid covariant return type (actual is more specific than expected)\n isAllowedCovariantSubtype(actualReturnType, expectedReturnType, _dereference)\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 function _assertPropertiesMatch(\n expected: spec.Property,\n actual: spec.Property,\n label: string,\n action: string,\n opts: {\n allowCovariance: 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.allowCovariance &&\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 isAllowedCovariantSubtype(actual.type, expected.type, _dereference)\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 const _dereference = createTypeResolver(assembly, validator.projectInfo.dependencyClosure);\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);\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);\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 _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.
|
|
2
|
+
export declare const SHORT_VERSION = "5.9.11-dev.0";
|
|
3
3
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
4
|
-
export declare const VERSION = "5.9.
|
|
4
|
+
export declare const VERSION = "5.9.11-dev.0 (build 9b1e593)";
|
|
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.
|
|
7
|
+
exports.SHORT_VERSION = '5.9.11-dev.0';
|
|
8
8
|
/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
|
|
9
|
-
exports.VERSION = '5.9.
|
|
9
|
+
exports.VERSION = '5.9.11-dev.0 (build 9b1e593)';
|
|
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
|
package/lib/version.js.map
CHANGED
|
@@ -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,
|
|
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,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,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.11-dev.0';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.9.11-dev.0 (build 9b1e593)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
|