diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a4ad9df0ead23..22d50881e3955 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16864,7 +16864,7 @@ namespace ts { if (source.flags & (TypeFlags.Object | TypeFlags.Conditional) && source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol && !(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) { - const variances = getAliasVariances(source.aliasSymbol); + const variances = getAliasVariances(source.aliasSymbol, relation === assignableRelation ? isRelatedTo : compareTypesAssignable); if (variances === emptyArray) { return Ternary.Maybe; } @@ -17095,7 +17095,7 @@ namespace ts { // We have type references to the same generic type, and the type references are not marker // type references (which are intended by be compared structurally). Obtain the variance // information for the type parameters and relate the type arguments accordingly. - const variances = getVariances((source).target); + const variances = getVariances((source).target, relation === assignableRelation ? isRelatedTo : compareTypesAssignable); // We return Ternary.Maybe for a recursive invocation of getVariances (signalled by emptyArray). This // effectively means we measure variance only from type parameter occurrences that aren't nested in // recursive instantiations of the generic type. @@ -17988,13 +17988,13 @@ namespace ts { return result; } - function getAliasVariances(symbol: Symbol) { + function getAliasVariances(symbol: Symbol, compareTypes: (source: Type, target: Type) => Ternary) { const links = getSymbolLinks(symbol); return getVariancesWorker(links.typeParameters, links, (_links, param, marker) => { const type = getTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters!, makeUnaryTypeMapper(param, marker))); type.aliasTypeArgumentsContainsMarker = true; return type; - }); + }, compareTypes); } // Return an array containing the variance of each type parameter. The variance is effectively @@ -18002,11 +18002,12 @@ namespace ts { // generic type are structurally compared. We infer the variance information by comparing // instantiations of the generic type for type arguments with known relations. The function // returns the emptyArray singleton when invoked recursively for the given generic type. - function getVariancesWorker(typeParameters: readonly TypeParameter[] = emptyArray, cache: TCache, createMarkerType: (input: TCache, param: TypeParameter, marker: Type) => Type): VarianceFlags[] { + function getVariancesWorker(typeParameters: readonly TypeParameter[] = emptyArray, cache: TCache, createMarkerType: (input: TCache, param: TypeParameter, marker: Type) => Type, compareTypes: (source: Type, target: Type) => Ternary): VarianceFlags[] { let variances = cache.variances; if (!variances) { // The emptyArray singleton is used to signal a recursive invocation. cache.variances = emptyArray; + let encounteredMaybeResult = false; variances = []; for (const tp of typeParameters) { let unmeasurable = false; @@ -18018,14 +18019,28 @@ namespace ts { // invariance, covariance, contravariance or bivariance. const typeWithSuper = createMarkerType(cache, tp, markerSuperType); const typeWithSub = createMarkerType(cache, tp, markerSubType); - let variance = (isTypeAssignableTo(typeWithSub, typeWithSuper) ? VarianceFlags.Covariant : 0) | - (isTypeAssignableTo(typeWithSuper, typeWithSub) ? VarianceFlags.Contravariant : 0); + + const subResult = compareTypes(typeWithSub, typeWithSuper); + const superResult = compareTypes(typeWithSuper, typeWithSub); + let variance = (subResult ? VarianceFlags.Covariant : 0) | + (superResult ? VarianceFlags.Contravariant : 0); + if (subResult === Ternary.Maybe || superResult === Ternary.Maybe) { + variance |= VarianceFlags.Unmeasurable; + encounteredMaybeResult = true; + } // If the instantiations appear to be related bivariantly it may be because the // type parameter is independent (i.e. it isn't witnessed anywhere in the generic // type). To determine this we compare instantiations where the type parameter is // replaced with marker types that are known to be unrelated. - if (variance === VarianceFlags.Bivariant && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) { - variance = VarianceFlags.Independent; + if (variance === VarianceFlags.Bivariant) { + const otherResult = compareTypes(createMarkerType(cache, tp, markerOtherType), typeWithSuper); + if (otherResult === Ternary.Maybe) { + variance |= VarianceFlags.Unmeasurable; + encounteredMaybeResult = true; + } + if (otherResult) { + variance = VarianceFlags.Independent; + } } outofbandVarianceMarkerHandler = oldHandler; if (unmeasurable || unreliable) { @@ -18038,17 +18053,22 @@ namespace ts { } variances.push(variance); } - cache.variances = variances; + if (!encounteredMaybeResult) { + cache.variances = variances; + } + else { + cache.variances = undefined; + } } return variances; } - function getVariances(type: GenericType): VarianceFlags[] { + function getVariances(type: GenericType, compareTypes: (source: Type, target: Type) => Ternary): VarianceFlags[] { // Arrays and tuples are known to be covariant, no need to spend time computing this. if (type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & ObjectFlags.Tuple) { return arrayVariances; } - return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference); + return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference, compareTypes); } // Return true if the given type reference has a 'void' type argument for a covariant type parameter. @@ -19313,7 +19333,7 @@ namespace ts { if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { // Source and target are types originating in the same generic type alias declaration. // Simply infer from source type arguments to target type arguments. - inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments!, getAliasVariances(source.aliasSymbol)); + inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments!, getAliasVariances(source.aliasSymbol, compareTypesAssignable)); return; } if (source === target && source.flags & TypeFlags.UnionOrIntersection) { @@ -19435,7 +19455,7 @@ namespace ts { (source).target === (target).target || isArrayType(source) && isArrayType(target)) && !((source).node && (target).node)) { // If source and target are references to the same generic type, infer from type arguments - inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances((source).target)); + inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances((source).target, compareTypesAssignable)); } else if (source.flags & TypeFlags.Index && target.flags & TypeFlags.Index) { contravariant = !contravariant; @@ -19758,7 +19778,7 @@ namespace ts { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && ( (source).target === (target).target || isArrayType(source) && isArrayType(target))) { // If source and target are references to the same generic type, infer from type arguments - inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances((source).target)); + inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances((source).target, compareTypesAssignable)); return; } if (isGenericMappedType(source) && isGenericMappedType(target)) { diff --git a/tests/baselines/reference/complexClassStructureNoCrash.js b/tests/baselines/reference/complexClassStructureNoCrash.js new file mode 100644 index 0000000000000..6b75d91aca977 --- /dev/null +++ b/tests/baselines/reference/complexClassStructureNoCrash.js @@ -0,0 +1,438 @@ +//// [complexClassStructureNoCrash.ts] +const { assign } = Object + +export type Name = string +export type List = ReadonlyArray +export type Payload = Record + +export type Stage = Raw | Filled | Linked +export abstract class Raw { protected readonly rawTag = 'Raw' } +export abstract class Filled extends Raw { protected readonly filledTag = 'Filled' } +export abstract class Linked extends Filled { protected readonly linkedTag = 'Linked' } +export type Final = Linked + +type Stageable = S extends C ? T : T | undefined +export type Fillable = Stageable +export type Linkable = Stageable + +export type Kind = Node['kind'] +export type Category = 'Entity' | 'Module' | 'Sentence' | 'Expression' +export type NodeOfKind = Extract, { kind: K }> +export type NodeOfKindOrCategory = + Q extends Kind ? NodeOfKind : + never + +export type Node + = Parameter + | NamedArgument + | Import + | Body + | Catch + | Entity + | DescribeMember + | ClassMember + | Sentence + +abstract class $Node { + readonly stage?: S + abstract readonly kind: Kind + + constructor(payload: Record) { + assign(this, payload) + } + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { + return this.kind === kindOrCategory + } +} + +export class Parameter extends $Node { + readonly kind = 'Parameter' +} + +export class NamedArgument extends $Node { + readonly kind = 'NamedArgument' + readonly value!: Expression +} + +export class Import extends $Node { + readonly kind = 'Import' + readonly entity!: Reference +} + +export class Body extends $Node { + readonly kind = 'Body' + readonly sentences!: List> +} + +export type Entity + = Package + | Program + | Test + | Describe + | Module + | Variable + + +export class Package extends $Node { + readonly kind = 'Package' + readonly imports!: List> + readonly members!: List> +} + +export class Program extends $Node { + readonly kind = 'Program' + readonly body!: Body +} + +export class Test extends $Node { + readonly kind = 'Test' + readonly body!: Body +} + +export class Describe extends $Node { + readonly kind = 'Describe' + readonly members!: List> + + tests(): List> { return this.members.filter((member): member is Test => member.is('Test')) } + methods(): List> { return this.members.filter((member): member is Method => member.is('Method')) } + variables(): List> { return this.members.filter((member): member is Variable => member.is('Variable')) } + fixtures(): List> { return this.members.filter((member): member is Fixture => member.is('Fixture')) } +} + +export class Variable extends $Node { + readonly kind = 'Variable' + readonly value!: Fillable> + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { + return [this.kind, 'Sentence', 'Entity'].includes(kindOrCategory) + } +} + +export type Module = Class | Singleton | Mixin + +export class Class extends $Node { + readonly kind = 'Class' + readonly mixins!: List> + readonly members!: List> + readonly superclass!: Fillable | null> +} + +export class Singleton extends $Node { + readonly kind = 'Singleton' + readonly mixins!: List> + readonly members!: List> + readonly superCall!: Fillable, + args: List> | List> + }> +} + +export class Mixin extends $Node { + readonly kind = 'Mixin' + readonly mixins!: List> + readonly members!: List> +} + +export type ObjectMember = Field | Method +export type ClassMember = Constructor | ObjectMember +export type DescribeMember = Variable | Fixture | Test | Method + +export class Field extends $Node { + readonly kind = 'Field' + readonly value!: Fillable> +} + +export class Method extends $Node { + readonly kind = 'Method' + readonly parameters!: List> + readonly body?: Body +} + +export class Constructor extends $Node { + readonly kind = 'Constructor' + readonly parameters!: List> + readonly body!: Body + readonly baseCall?: { callsSuper: boolean, args: List> } +} + +export class Fixture extends $Node { + readonly kind = 'Fixture' + readonly body!: Body +} + +export type Sentence = Variable | Return | Assignment | Expression + +export class Return extends $Node { + readonly kind = 'Return' + readonly value?: Expression +} + +export class Assignment extends $Node { + readonly kind = 'Assignment' + readonly variable!: Reference + readonly value!: Expression +} + +export type Expression + = Reference + | Self + | Send + | Super + | New + | If + | Throw + | Try + +abstract class $Expression extends $Node { + is(kindOrCategory: Q): this is NodeOfKindOrCategory { + return kindOrCategory === 'Expression' || super.is(kindOrCategory) + } +} + +export class Reference extends $Expression { + readonly kind = 'Reference' + readonly name!: Name +} + +export class Self extends $Expression { + readonly kind = 'Self' +} + +export class Send extends $Expression { + readonly kind = 'Send' + readonly receiver!: Expression + readonly message!: Name + readonly args!: List> +} + +export class Super extends $Expression { + readonly kind = 'Super' + readonly args!: List> +} + +export class New extends $Expression { + readonly kind = 'New' + readonly instantiated!: Reference + readonly args!: List> | List> +} + +export class If extends $Expression { + readonly kind = 'If' + readonly thenBody!: Body + readonly elseBody!: Fillable> +} + +export class Throw extends $Expression { + readonly kind = 'Throw' +} + +export class Try extends $Expression { + readonly kind = 'Try' +} + +export class Catch extends $Expression { + readonly kind = 'Catch' +} + +//// [complexClassStructureNoCrash.js] +const { assign } = Object; +export class Raw { + constructor() { + this.rawTag = 'Raw'; + } +} +export class Filled extends Raw { + constructor() { + super(...arguments); + this.filledTag = 'Filled'; + } +} +export class Linked extends Filled { + constructor() { + super(...arguments); + this.linkedTag = 'Linked'; + } +} +class $Node { + constructor(payload) { + assign(this, payload); + } + is(kindOrCategory) { + return this.kind === kindOrCategory; + } +} +export class Parameter extends $Node { + constructor() { + super(...arguments); + this.kind = 'Parameter'; + } +} +export class NamedArgument extends $Node { + constructor() { + super(...arguments); + this.kind = 'NamedArgument'; + } +} +export class Import extends $Node { + constructor() { + super(...arguments); + this.kind = 'Import'; + } +} +export class Body extends $Node { + constructor() { + super(...arguments); + this.kind = 'Body'; + } +} +export class Package extends $Node { + constructor() { + super(...arguments); + this.kind = 'Package'; + } +} +export class Program extends $Node { + constructor() { + super(...arguments); + this.kind = 'Program'; + } +} +export class Test extends $Node { + constructor() { + super(...arguments); + this.kind = 'Test'; + } +} +export class Describe extends $Node { + constructor() { + super(...arguments); + this.kind = 'Describe'; + } + tests() { return this.members.filter((member) => member.is('Test')); } + methods() { return this.members.filter((member) => member.is('Method')); } + variables() { return this.members.filter((member) => member.is('Variable')); } + fixtures() { return this.members.filter((member) => member.is('Fixture')); } +} +export class Variable extends $Node { + constructor() { + super(...arguments); + this.kind = 'Variable'; + } + is(kindOrCategory) { + return [this.kind, 'Sentence', 'Entity'].includes(kindOrCategory); + } +} +export class Class extends $Node { + constructor() { + super(...arguments); + this.kind = 'Class'; + } +} +export class Singleton extends $Node { + constructor() { + super(...arguments); + this.kind = 'Singleton'; + } +} +export class Mixin extends $Node { + constructor() { + super(...arguments); + this.kind = 'Mixin'; + } +} +export class Field extends $Node { + constructor() { + super(...arguments); + this.kind = 'Field'; + } +} +export class Method extends $Node { + constructor() { + super(...arguments); + this.kind = 'Method'; + } +} +export class Constructor extends $Node { + constructor() { + super(...arguments); + this.kind = 'Constructor'; + } +} +export class Fixture extends $Node { + constructor() { + super(...arguments); + this.kind = 'Fixture'; + } +} +export class Return extends $Node { + constructor() { + super(...arguments); + this.kind = 'Return'; + } +} +export class Assignment extends $Node { + constructor() { + super(...arguments); + this.kind = 'Assignment'; + } +} +class $Expression extends $Node { + is(kindOrCategory) { + return kindOrCategory === 'Expression' || super.is(kindOrCategory); + } +} +export class Reference extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Reference'; + } +} +export class Self extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Self'; + } +} +export class Send extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Send'; + } +} +export class Super extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Super'; + } +} +export class New extends $Expression { + constructor() { + super(...arguments); + this.kind = 'New'; + } +} +export class If extends $Expression { + constructor() { + super(...arguments); + this.kind = 'If'; + } +} +export class Throw extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Throw'; + } +} +export class Try extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Try'; + } +} +export class Catch extends $Expression { + constructor() { + super(...arguments); + this.kind = 'Catch'; + } +} diff --git a/tests/baselines/reference/complexClassStructureNoCrash.symbols b/tests/baselines/reference/complexClassStructureNoCrash.symbols new file mode 100644 index 0000000000000..252e22f96f497 --- /dev/null +++ b/tests/baselines/reference/complexClassStructureNoCrash.symbols @@ -0,0 +1,989 @@ +=== tests/cases/compiler/complexClassStructureNoCrash.ts === +const { assign } = Object +>assign : Symbol(assign, Decl(complexClassStructureNoCrash.ts, 0, 7)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +export type Name = string +>Name : Symbol(Name, Decl(complexClassStructureNoCrash.ts, 0, 25)) + +export type List = ReadonlyArray +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 3, 17)) +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 3, 17)) + +export type Payload = Record +>Payload : Symbol(Payload, Decl(complexClassStructureNoCrash.ts, 3, 38)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 4, 20)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + +export type Stage = Raw | Filled | Linked +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Raw : Symbol(Raw, Decl(complexClassStructureNoCrash.ts, 6, 41)) +>Filled : Symbol(Filled, Decl(complexClassStructureNoCrash.ts, 7, 63)) +>Linked : Symbol(Linked, Decl(complexClassStructureNoCrash.ts, 8, 84)) + +export abstract class Raw { protected readonly rawTag = 'Raw' } +>Raw : Symbol(Raw, Decl(complexClassStructureNoCrash.ts, 6, 41)) +>rawTag : Symbol(Raw.rawTag, Decl(complexClassStructureNoCrash.ts, 7, 27)) + +export abstract class Filled extends Raw { protected readonly filledTag = 'Filled' } +>Filled : Symbol(Filled, Decl(complexClassStructureNoCrash.ts, 7, 63)) +>Raw : Symbol(Raw, Decl(complexClassStructureNoCrash.ts, 6, 41)) +>filledTag : Symbol(Filled.filledTag, Decl(complexClassStructureNoCrash.ts, 8, 42)) + +export abstract class Linked extends Filled { protected readonly linkedTag = 'Linked' } +>Linked : Symbol(Linked, Decl(complexClassStructureNoCrash.ts, 8, 84)) +>Filled : Symbol(Filled, Decl(complexClassStructureNoCrash.ts, 7, 63)) +>linkedTag : Symbol(Linked.linkedTag, Decl(complexClassStructureNoCrash.ts, 9, 45)) + +export type Final = Linked +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>Linked : Symbol(Linked, Decl(complexClassStructureNoCrash.ts, 8, 84)) + +type Stageable = S extends C ? T : T | undefined +>Stageable : Symbol(Stageable, Decl(complexClassStructureNoCrash.ts, 10, 26)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 12, 15)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>C : Symbol(C, Decl(complexClassStructureNoCrash.ts, 12, 31)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 12, 48)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 12, 15)) +>C : Symbol(C, Decl(complexClassStructureNoCrash.ts, 12, 31)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 12, 48)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 12, 48)) + +export type Fillable = Stageable +>Fillable : Symbol(Fillable, Decl(complexClassStructureNoCrash.ts, 12, 85)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 13, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 13, 37)) +>Stageable : Symbol(Stageable, Decl(complexClassStructureNoCrash.ts, 10, 26)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 13, 21)) +>Filled : Symbol(Filled, Decl(complexClassStructureNoCrash.ts, 7, 63)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 13, 37)) + +export type Linkable = Stageable +>Linkable : Symbol(Linkable, Decl(complexClassStructureNoCrash.ts, 13, 66)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 14, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 14, 37)) +>Stageable : Symbol(Stageable, Decl(complexClassStructureNoCrash.ts, 10, 26)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 14, 21)) +>Linked : Symbol(Linked, Decl(complexClassStructureNoCrash.ts, 8, 84)) +>T : Symbol(T, Decl(complexClassStructureNoCrash.ts, 14, 37)) + +export type Kind = Node['kind'] +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>Node : Symbol(Node, Decl(complexClassStructureNoCrash.ts, 21, 7)) + +export type Category = 'Entity' | 'Module' | 'Sentence' | 'Expression' +>Category : Symbol(Category, Decl(complexClassStructureNoCrash.ts, 16, 31)) + +export type NodeOfKind = Extract, { kind: K }> +>NodeOfKind : Symbol(NodeOfKind, Decl(complexClassStructureNoCrash.ts, 17, 70)) +>K : Symbol(K, Decl(complexClassStructureNoCrash.ts, 18, 23)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 18, 38)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --)) +>Node : Symbol(Node, Decl(complexClassStructureNoCrash.ts, 21, 7)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 18, 38)) +>kind : Symbol(kind, Decl(complexClassStructureNoCrash.ts, 18, 76)) +>K : Symbol(K, Decl(complexClassStructureNoCrash.ts, 18, 23)) + +export type NodeOfKindOrCategory = +>NodeOfKindOrCategory : Symbol(NodeOfKindOrCategory, Decl(complexClassStructureNoCrash.ts, 18, 87)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 19, 33)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>Category : Symbol(Category, Decl(complexClassStructureNoCrash.ts, 16, 31)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 19, 59)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) + + Q extends Kind ? NodeOfKind : +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 19, 33)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>NodeOfKind : Symbol(NodeOfKind, Decl(complexClassStructureNoCrash.ts, 17, 70)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 19, 33)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 19, 59)) + + never + +export type Node +>Node : Symbol(Node, Decl(complexClassStructureNoCrash.ts, 21, 7)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) + + = Parameter +>Parameter : Symbol(Parameter, Decl(complexClassStructureNoCrash.ts, 45, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | NamedArgument +>NamedArgument : Symbol(NamedArgument, Decl(complexClassStructureNoCrash.ts, 49, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | Import +>Import : Symbol(Import, Decl(complexClassStructureNoCrash.ts, 54, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | Body +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | Catch +>Catch : Symbol(Catch, Decl(complexClassStructureNoCrash.ts, 230, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | Entity +>Entity : Symbol(Entity, Decl(complexClassStructureNoCrash.ts, 64, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | DescribeMember +>DescribeMember : Symbol(DescribeMember, Decl(complexClassStructureNoCrash.ts, 136, 83)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | ClassMember +>ClassMember : Symbol(ClassMember, Decl(complexClassStructureNoCrash.ts, 135, 72)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + + | Sentence +>Sentence : Symbol(Sentence, Decl(complexClassStructureNoCrash.ts, 160, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 23, 17)) + +abstract class $Node { +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 34, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) + + readonly stage?: S +>stage : Symbol($Node.stage, Decl(complexClassStructureNoCrash.ts, 34, 39)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 34, 21)) + + abstract readonly kind: Kind +>kind : Symbol($Node.kind, Decl(complexClassStructureNoCrash.ts, 35, 20)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) + + constructor(payload: Record) { +>payload : Symbol(payload, Decl(complexClassStructureNoCrash.ts, 38, 14)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + + assign(this, payload) +>assign : Symbol(assign, Decl(complexClassStructureNoCrash.ts, 0, 7)) +>this : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>payload : Symbol(payload, Decl(complexClassStructureNoCrash.ts, 38, 14)) + } + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { +>is : Symbol($Node.is, Decl(complexClassStructureNoCrash.ts, 40, 3)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 42, 5)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>Category : Symbol(Category, Decl(complexClassStructureNoCrash.ts, 16, 31)) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 42, 32)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 42, 5)) +>NodeOfKindOrCategory : Symbol(NodeOfKindOrCategory, Decl(complexClassStructureNoCrash.ts, 18, 87)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 42, 5)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 34, 21)) + + return this.kind === kindOrCategory +>this.kind : Symbol($Node.kind, Decl(complexClassStructureNoCrash.ts, 35, 20)) +>this : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>kind : Symbol($Node.kind, Decl(complexClassStructureNoCrash.ts, 35, 20)) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 42, 32)) + } +} + +export class Parameter extends $Node { +>Parameter : Symbol(Parameter, Decl(complexClassStructureNoCrash.ts, 45, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 47, 23)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 47, 23)) + + readonly kind = 'Parameter' +>kind : Symbol(Parameter.kind, Decl(complexClassStructureNoCrash.ts, 47, 66)) +} + +export class NamedArgument extends $Node { +>NamedArgument : Symbol(NamedArgument, Decl(complexClassStructureNoCrash.ts, 49, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 51, 27)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 51, 27)) + + readonly kind = 'NamedArgument' +>kind : Symbol(NamedArgument.kind, Decl(complexClassStructureNoCrash.ts, 51, 70)) + + readonly value!: Expression +>value : Symbol(NamedArgument.value, Decl(complexClassStructureNoCrash.ts, 52, 33)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 51, 27)) +} + +export class Import extends $Node { +>Import : Symbol(Import, Decl(complexClassStructureNoCrash.ts, 54, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 56, 20)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 56, 20)) + + readonly kind = 'Import' +>kind : Symbol(Import.kind, Decl(complexClassStructureNoCrash.ts, 56, 63)) + + readonly entity!: Reference +>entity : Symbol(Import.entity, Decl(complexClassStructureNoCrash.ts, 57, 26)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 56, 20)) +} + +export class Body extends $Node { +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 61, 18)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 61, 18)) + + readonly kind = 'Body' +>kind : Symbol(Body.kind, Decl(complexClassStructureNoCrash.ts, 61, 61)) + + readonly sentences!: List> +>sentences : Symbol(Body.sentences, Decl(complexClassStructureNoCrash.ts, 62, 24)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Sentence : Symbol(Sentence, Decl(complexClassStructureNoCrash.ts, 160, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 61, 18)) +} + +export type Entity +>Entity : Symbol(Entity, Decl(complexClassStructureNoCrash.ts, 64, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) + + = Package +>Package : Symbol(Package, Decl(complexClassStructureNoCrash.ts, 72, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) + + | Program +>Program : Symbol(Program, Decl(complexClassStructureNoCrash.ts, 79, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) + + | Test +>Test : Symbol(Test, Decl(complexClassStructureNoCrash.ts, 84, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) + + | Describe +>Describe : Symbol(Describe, Decl(complexClassStructureNoCrash.ts, 89, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) + + | Module +>Module : Symbol(Module, Decl(complexClassStructureNoCrash.ts, 108, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) + + | Variable +>Variable : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 66, 19)) + + +export class Package extends $Node { +>Package : Symbol(Package, Decl(complexClassStructureNoCrash.ts, 72, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 75, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 75, 21)) + + readonly kind = 'Package' +>kind : Symbol(Package.kind, Decl(complexClassStructureNoCrash.ts, 75, 64)) + + readonly imports!: List> +>imports : Symbol(Package.imports, Decl(complexClassStructureNoCrash.ts, 76, 27)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Import : Symbol(Import, Decl(complexClassStructureNoCrash.ts, 54, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 75, 21)) + + readonly members!: List> +>members : Symbol(Package.members, Decl(complexClassStructureNoCrash.ts, 77, 36)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Entity : Symbol(Entity, Decl(complexClassStructureNoCrash.ts, 64, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 75, 21)) +} + +export class Program extends $Node { +>Program : Symbol(Program, Decl(complexClassStructureNoCrash.ts, 79, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 81, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 81, 21)) + + readonly kind = 'Program' +>kind : Symbol(Program.kind, Decl(complexClassStructureNoCrash.ts, 81, 64)) + + readonly body!: Body +>body : Symbol(Program.body, Decl(complexClassStructureNoCrash.ts, 82, 27)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 81, 21)) +} + +export class Test extends $Node { +>Test : Symbol(Test, Decl(complexClassStructureNoCrash.ts, 84, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 86, 18)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 86, 18)) + + readonly kind = 'Test' +>kind : Symbol(Test.kind, Decl(complexClassStructureNoCrash.ts, 86, 61)) + + readonly body!: Body +>body : Symbol(Test.body, Decl(complexClassStructureNoCrash.ts, 87, 24)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 86, 18)) +} + +export class Describe extends $Node { +>Describe : Symbol(Describe, Decl(complexClassStructureNoCrash.ts, 89, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) + + readonly kind = 'Describe' +>kind : Symbol(Describe.kind, Decl(complexClassStructureNoCrash.ts, 91, 65)) + + readonly members!: List> +>members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>DescribeMember : Symbol(DescribeMember, Decl(complexClassStructureNoCrash.ts, 136, 83)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) + + tests(): List> { return this.members.filter((member): member is Test => member.is('Test')) } +>tests : Symbol(Describe.tests, Decl(complexClassStructureNoCrash.ts, 93, 44)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Test : Symbol(Test, Decl(complexClassStructureNoCrash.ts, 84, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>this.members.filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>this.members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>this : Symbol(Describe, Decl(complexClassStructureNoCrash.ts, 89, 1)) +>members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 95, 55)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 95, 55)) +>Test : Symbol(Test, Decl(complexClassStructureNoCrash.ts, 84, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>member.is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 95, 55)) +>is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) + + methods(): List> { return this.members.filter((member): member is Method => member.is('Method')) } +>methods : Symbol(Describe.methods, Decl(complexClassStructureNoCrash.ts, 95, 105)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Method : Symbol(Method, Decl(complexClassStructureNoCrash.ts, 142, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>this.members.filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>this.members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>this : Symbol(Describe, Decl(complexClassStructureNoCrash.ts, 89, 1)) +>members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 96, 59)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 96, 59)) +>Method : Symbol(Method, Decl(complexClassStructureNoCrash.ts, 142, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>member.is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 96, 59)) +>is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) + + variables(): List> { return this.members.filter((member): member is Variable => member.is('Variable')) } +>variables : Symbol(Describe.variables, Decl(complexClassStructureNoCrash.ts, 96, 113)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Variable : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>this.members.filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>this.members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>this : Symbol(Describe, Decl(complexClassStructureNoCrash.ts, 89, 1)) +>members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 97, 63)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 97, 63)) +>Variable : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>member.is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 97, 63)) +>is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) + + fixtures(): List> { return this.members.filter((member): member is Fixture => member.is('Fixture')) } +>fixtures : Symbol(Describe.fixtures, Decl(complexClassStructureNoCrash.ts, 97, 121)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Fixture : Symbol(Fixture, Decl(complexClassStructureNoCrash.ts, 155, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>this.members.filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>this.members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>this : Symbol(Describe, Decl(complexClassStructureNoCrash.ts, 89, 1)) +>members : Symbol(Describe.members, Decl(complexClassStructureNoCrash.ts, 92, 28)) +>filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 98, 61)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 98, 61)) +>Fixture : Symbol(Fixture, Decl(complexClassStructureNoCrash.ts, 155, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 91, 22)) +>member.is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) +>member : Symbol(member, Decl(complexClassStructureNoCrash.ts, 98, 61)) +>is : Symbol(is, Decl(complexClassStructureNoCrash.ts, 103, 45), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3), Decl(complexClassStructureNoCrash.ts, 40, 3)) +} + +export class Variable extends $Node { +>Variable : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 101, 22)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 101, 22)) + + readonly kind = 'Variable' +>kind : Symbol(Variable.kind, Decl(complexClassStructureNoCrash.ts, 101, 65)) + + readonly value!: Fillable> +>value : Symbol(Variable.value, Decl(complexClassStructureNoCrash.ts, 102, 28)) +>Fillable : Symbol(Fillable, Decl(complexClassStructureNoCrash.ts, 12, 85)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 101, 22)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 101, 22)) + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { +>is : Symbol(Variable.is, Decl(complexClassStructureNoCrash.ts, 103, 45)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 105, 5)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>Category : Symbol(Category, Decl(complexClassStructureNoCrash.ts, 16, 31)) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 105, 32)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 105, 5)) +>NodeOfKindOrCategory : Symbol(NodeOfKindOrCategory, Decl(complexClassStructureNoCrash.ts, 18, 87)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 105, 5)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 101, 22)) + + return [this.kind, 'Sentence', 'Entity'].includes(kindOrCategory) +>[this.kind, 'Sentence', 'Entity'].includes : Symbol(Array.includes, Decl(lib.es2016.array.include.d.ts, --, --)) +>this.kind : Symbol(Variable.kind, Decl(complexClassStructureNoCrash.ts, 101, 65)) +>this : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>kind : Symbol(Variable.kind, Decl(complexClassStructureNoCrash.ts, 101, 65)) +>includes : Symbol(Array.includes, Decl(lib.es2016.array.include.d.ts, --, --)) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 105, 32)) + } +} + +export type Module = Class | Singleton | Mixin +>Module : Symbol(Module, Decl(complexClassStructureNoCrash.ts, 108, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 110, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>Class : Symbol(Class, Decl(complexClassStructureNoCrash.ts, 110, 80)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 110, 19)) +>Singleton : Symbol(Singleton, Decl(complexClassStructureNoCrash.ts, 117, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 110, 19)) +>Mixin : Symbol(Mixin, Decl(complexClassStructureNoCrash.ts, 127, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 110, 19)) + +export class Class extends $Node { +>Class : Symbol(Class, Decl(complexClassStructureNoCrash.ts, 110, 80)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 112, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 112, 19)) + + readonly kind = 'Class' +>kind : Symbol(Class.kind, Decl(complexClassStructureNoCrash.ts, 112, 62)) + + readonly mixins!: List> +>mixins : Symbol(Class.mixins, Decl(complexClassStructureNoCrash.ts, 113, 25)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 112, 19)) + + readonly members!: List> +>members : Symbol(Class.members, Decl(complexClassStructureNoCrash.ts, 114, 38)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>ClassMember : Symbol(ClassMember, Decl(complexClassStructureNoCrash.ts, 135, 72)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 112, 19)) + + readonly superclass!: Fillable | null> +>superclass : Symbol(Class.superclass, Decl(complexClassStructureNoCrash.ts, 115, 41)) +>Fillable : Symbol(Fillable, Decl(complexClassStructureNoCrash.ts, 12, 85)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 112, 19)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 112, 19)) +} + +export class Singleton extends $Node { +>Singleton : Symbol(Singleton, Decl(complexClassStructureNoCrash.ts, 117, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) + + readonly kind = 'Singleton' +>kind : Symbol(Singleton.kind, Decl(complexClassStructureNoCrash.ts, 119, 66)) + + readonly mixins!: List> +>mixins : Symbol(Singleton.mixins, Decl(complexClassStructureNoCrash.ts, 120, 29)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) + + readonly members!: List> +>members : Symbol(Singleton.members, Decl(complexClassStructureNoCrash.ts, 121, 38)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>ObjectMember : Symbol(ObjectMember, Decl(complexClassStructureNoCrash.ts, 133, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) + + readonly superCall!: FillablesuperCall : Symbol(Singleton.superCall, Decl(complexClassStructureNoCrash.ts, 122, 42)) +>Fillable : Symbol(Fillable, Decl(complexClassStructureNoCrash.ts, 12, 85)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) + + superclass: Reference, +>superclass : Symbol(superclass, Decl(complexClassStructureNoCrash.ts, 123, 36)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) + + args: List> | List> +>args : Symbol(args, Decl(complexClassStructureNoCrash.ts, 124, 29)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>NamedArgument : Symbol(NamedArgument, Decl(complexClassStructureNoCrash.ts, 49, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 119, 23)) + + }> +} + +export class Mixin extends $Node { +>Mixin : Symbol(Mixin, Decl(complexClassStructureNoCrash.ts, 127, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 129, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 129, 19)) + + readonly kind = 'Mixin' +>kind : Symbol(Mixin.kind, Decl(complexClassStructureNoCrash.ts, 129, 62)) + + readonly mixins!: List> +>mixins : Symbol(Mixin.mixins, Decl(complexClassStructureNoCrash.ts, 130, 25)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 129, 19)) + + readonly members!: List> +>members : Symbol(Mixin.members, Decl(complexClassStructureNoCrash.ts, 131, 38)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>ObjectMember : Symbol(ObjectMember, Decl(complexClassStructureNoCrash.ts, 133, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 129, 19)) +} + +export type ObjectMember = Field | Method +>ObjectMember : Symbol(ObjectMember, Decl(complexClassStructureNoCrash.ts, 133, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 135, 25)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>Field : Symbol(Field, Decl(complexClassStructureNoCrash.ts, 137, 100)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 135, 25)) +>Method : Symbol(Method, Decl(complexClassStructureNoCrash.ts, 142, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 135, 25)) + +export type ClassMember = Constructor | ObjectMember +>ClassMember : Symbol(ClassMember, Decl(complexClassStructureNoCrash.ts, 135, 72)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 136, 24)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>Constructor : Symbol(Constructor, Decl(complexClassStructureNoCrash.ts, 148, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 136, 24)) +>ObjectMember : Symbol(ObjectMember, Decl(complexClassStructureNoCrash.ts, 133, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 136, 24)) + +export type DescribeMember = Variable | Fixture | Test | Method +>DescribeMember : Symbol(DescribeMember, Decl(complexClassStructureNoCrash.ts, 136, 83)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 137, 27)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>Variable : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 137, 27)) +>Fixture : Symbol(Fixture, Decl(complexClassStructureNoCrash.ts, 155, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 137, 27)) +>Test : Symbol(Test, Decl(complexClassStructureNoCrash.ts, 84, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 137, 27)) +>Method : Symbol(Method, Decl(complexClassStructureNoCrash.ts, 142, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 137, 27)) + +export class Field extends $Node { +>Field : Symbol(Field, Decl(complexClassStructureNoCrash.ts, 137, 100)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 139, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 139, 19)) + + readonly kind = 'Field' +>kind : Symbol(Field.kind, Decl(complexClassStructureNoCrash.ts, 139, 62)) + + readonly value!: Fillable> +>value : Symbol(Field.value, Decl(complexClassStructureNoCrash.ts, 140, 25)) +>Fillable : Symbol(Fillable, Decl(complexClassStructureNoCrash.ts, 12, 85)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 139, 19)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 139, 19)) +} + +export class Method extends $Node { +>Method : Symbol(Method, Decl(complexClassStructureNoCrash.ts, 142, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 144, 20)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 144, 20)) + + readonly kind = 'Method' +>kind : Symbol(Method.kind, Decl(complexClassStructureNoCrash.ts, 144, 63)) + + readonly parameters!: List> +>parameters : Symbol(Method.parameters, Decl(complexClassStructureNoCrash.ts, 145, 26)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Parameter : Symbol(Parameter, Decl(complexClassStructureNoCrash.ts, 45, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 144, 20)) + + readonly body?: Body +>body : Symbol(Method.body, Decl(complexClassStructureNoCrash.ts, 146, 42)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 144, 20)) +} + +export class Constructor extends $Node { +>Constructor : Symbol(Constructor, Decl(complexClassStructureNoCrash.ts, 148, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 150, 25)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 150, 25)) + + readonly kind = 'Constructor' +>kind : Symbol(Constructor.kind, Decl(complexClassStructureNoCrash.ts, 150, 68)) + + readonly parameters!: List> +>parameters : Symbol(Constructor.parameters, Decl(complexClassStructureNoCrash.ts, 151, 31)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Parameter : Symbol(Parameter, Decl(complexClassStructureNoCrash.ts, 45, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 150, 25)) + + readonly body!: Body +>body : Symbol(Constructor.body, Decl(complexClassStructureNoCrash.ts, 152, 42)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 150, 25)) + + readonly baseCall?: { callsSuper: boolean, args: List> } +>baseCall : Symbol(Constructor.baseCall, Decl(complexClassStructureNoCrash.ts, 153, 25)) +>callsSuper : Symbol(callsSuper, Decl(complexClassStructureNoCrash.ts, 154, 23)) +>args : Symbol(args, Decl(complexClassStructureNoCrash.ts, 154, 44)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 150, 25)) +} + +export class Fixture extends $Node { +>Fixture : Symbol(Fixture, Decl(complexClassStructureNoCrash.ts, 155, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 157, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 157, 21)) + + readonly kind = 'Fixture' +>kind : Symbol(Fixture.kind, Decl(complexClassStructureNoCrash.ts, 157, 64)) + + readonly body!: Body +>body : Symbol(Fixture.body, Decl(complexClassStructureNoCrash.ts, 158, 27)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 157, 21)) +} + +export type Sentence = Variable | Return | Assignment | Expression +>Sentence : Symbol(Sentence, Decl(complexClassStructureNoCrash.ts, 160, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 162, 21)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>Variable : Symbol(Variable, Decl(complexClassStructureNoCrash.ts, 99, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 162, 21)) +>Return : Symbol(Return, Decl(complexClassStructureNoCrash.ts, 162, 103)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 162, 21)) +>Assignment : Symbol(Assignment, Decl(complexClassStructureNoCrash.ts, 167, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 162, 21)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 162, 21)) + +export class Return extends $Node { +>Return : Symbol(Return, Decl(complexClassStructureNoCrash.ts, 162, 103)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 164, 20)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 164, 20)) + + readonly kind = 'Return' +>kind : Symbol(Return.kind, Decl(complexClassStructureNoCrash.ts, 164, 63)) + + readonly value?: Expression +>value : Symbol(Return.value, Decl(complexClassStructureNoCrash.ts, 165, 26)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 164, 20)) +} + +export class Assignment extends $Node { +>Assignment : Symbol(Assignment, Decl(complexClassStructureNoCrash.ts, 167, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 169, 24)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 169, 24)) + + readonly kind = 'Assignment' +>kind : Symbol(Assignment.kind, Decl(complexClassStructureNoCrash.ts, 169, 67)) + + readonly variable!: Reference +>variable : Symbol(Assignment.variable, Decl(complexClassStructureNoCrash.ts, 170, 30)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 169, 24)) + + readonly value!: Expression +>value : Symbol(Assignment.value, Decl(complexClassStructureNoCrash.ts, 171, 34)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 169, 24)) +} + +export type Expression +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) + + = Reference +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | Self +>Self : Symbol(Self, Decl(complexClassStructureNoCrash.ts, 194, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | Send +>Send : Symbol(Send, Decl(complexClassStructureNoCrash.ts, 198, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | Super +>Super : Symbol(Super, Decl(complexClassStructureNoCrash.ts, 205, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | New +>New : Symbol(New, Decl(complexClassStructureNoCrash.ts, 210, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | If +>If : Symbol(If, Decl(complexClassStructureNoCrash.ts, 216, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | Throw +>Throw : Symbol(Throw, Decl(complexClassStructureNoCrash.ts, 222, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + + | Try +>Try : Symbol(Try, Decl(complexClassStructureNoCrash.ts, 226, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 175, 23)) + +abstract class $Expression extends $Node { +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 185, 27)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>$Node : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 185, 27)) + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { +>is : Symbol($Expression.is, Decl(complexClassStructureNoCrash.ts, 185, 62)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 186, 5)) +>Kind : Symbol(Kind, Decl(complexClassStructureNoCrash.ts, 14, 66)) +>Category : Symbol(Category, Decl(complexClassStructureNoCrash.ts, 16, 31)) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 186, 32)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 186, 5)) +>NodeOfKindOrCategory : Symbol(NodeOfKindOrCategory, Decl(complexClassStructureNoCrash.ts, 18, 87)) +>Q : Symbol(Q, Decl(complexClassStructureNoCrash.ts, 186, 5)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 185, 27)) + + return kindOrCategory === 'Expression' || super.is(kindOrCategory) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 186, 32)) +>super.is : Symbol($Node.is, Decl(complexClassStructureNoCrash.ts, 40, 3)) +>super : Symbol($Node, Decl(complexClassStructureNoCrash.ts, 32, 15)) +>is : Symbol($Node.is, Decl(complexClassStructureNoCrash.ts, 40, 3)) +>kindOrCategory : Symbol(kindOrCategory, Decl(complexClassStructureNoCrash.ts, 186, 32)) + } +} + +export class Reference extends $Expression { +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 191, 23)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 191, 23)) + + readonly kind = 'Reference' +>kind : Symbol(Reference.kind, Decl(complexClassStructureNoCrash.ts, 191, 72)) + + readonly name!: Name +>name : Symbol(Reference.name, Decl(complexClassStructureNoCrash.ts, 192, 29)) +>Name : Symbol(Name, Decl(complexClassStructureNoCrash.ts, 0, 25)) +} + +export class Self extends $Expression { +>Self : Symbol(Self, Decl(complexClassStructureNoCrash.ts, 194, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 196, 18)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 196, 18)) + + readonly kind = 'Self' +>kind : Symbol(Self.kind, Decl(complexClassStructureNoCrash.ts, 196, 67)) +} + +export class Send extends $Expression { +>Send : Symbol(Send, Decl(complexClassStructureNoCrash.ts, 198, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 200, 18)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 200, 18)) + + readonly kind = 'Send' +>kind : Symbol(Send.kind, Decl(complexClassStructureNoCrash.ts, 200, 67)) + + readonly receiver!: Expression +>receiver : Symbol(Send.receiver, Decl(complexClassStructureNoCrash.ts, 201, 24)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 200, 18)) + + readonly message!: Name +>message : Symbol(Send.message, Decl(complexClassStructureNoCrash.ts, 202, 35)) +>Name : Symbol(Name, Decl(complexClassStructureNoCrash.ts, 0, 25)) + + readonly args!: List> +>args : Symbol(Send.args, Decl(complexClassStructureNoCrash.ts, 203, 25)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 200, 18)) +} + +export class Super extends $Expression { +>Super : Symbol(Super, Decl(complexClassStructureNoCrash.ts, 205, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 207, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 207, 19)) + + readonly kind = 'Super' +>kind : Symbol(Super.kind, Decl(complexClassStructureNoCrash.ts, 207, 68)) + + readonly args!: List> +>args : Symbol(Super.args, Decl(complexClassStructureNoCrash.ts, 208, 25)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 207, 19)) +} + +export class New extends $Expression { +>New : Symbol(New, Decl(complexClassStructureNoCrash.ts, 210, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 212, 17)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 212, 17)) + + readonly kind = 'New' +>kind : Symbol(New.kind, Decl(complexClassStructureNoCrash.ts, 212, 66)) + + readonly instantiated!: Reference +>instantiated : Symbol(New.instantiated, Decl(complexClassStructureNoCrash.ts, 213, 23)) +>Reference : Symbol(Reference, Decl(complexClassStructureNoCrash.ts, 189, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 212, 17)) + + readonly args!: List> | List> +>args : Symbol(New.args, Decl(complexClassStructureNoCrash.ts, 214, 38)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>Expression : Symbol(Expression, Decl(complexClassStructureNoCrash.ts, 173, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 212, 17)) +>List : Symbol(List, Decl(complexClassStructureNoCrash.ts, 2, 25)) +>NamedArgument : Symbol(NamedArgument, Decl(complexClassStructureNoCrash.ts, 49, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 212, 17)) +} + +export class If extends $Expression { +>If : Symbol(If, Decl(complexClassStructureNoCrash.ts, 216, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 218, 16)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 218, 16)) + + readonly kind = 'If' +>kind : Symbol(If.kind, Decl(complexClassStructureNoCrash.ts, 218, 65)) + + readonly thenBody!: Body +>thenBody : Symbol(If.thenBody, Decl(complexClassStructureNoCrash.ts, 219, 22)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 218, 16)) + + readonly elseBody!: Fillable> +>elseBody : Symbol(If.elseBody, Decl(complexClassStructureNoCrash.ts, 220, 29)) +>Fillable : Symbol(Fillable, Decl(complexClassStructureNoCrash.ts, 12, 85)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 218, 16)) +>Body : Symbol(Body, Decl(complexClassStructureNoCrash.ts, 59, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 218, 16)) +} + +export class Throw extends $Expression { +>Throw : Symbol(Throw, Decl(complexClassStructureNoCrash.ts, 222, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 224, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 224, 19)) + + readonly kind = 'Throw' +>kind : Symbol(Throw.kind, Decl(complexClassStructureNoCrash.ts, 224, 68)) +} + +export class Try extends $Expression { +>Try : Symbol(Try, Decl(complexClassStructureNoCrash.ts, 226, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 228, 17)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 228, 17)) + + readonly kind = 'Try' +>kind : Symbol(Try.kind, Decl(complexClassStructureNoCrash.ts, 228, 66)) +} + +export class Catch extends $Expression { +>Catch : Symbol(Catch, Decl(complexClassStructureNoCrash.ts, 230, 1)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 232, 19)) +>Stage : Symbol(Stage, Decl(complexClassStructureNoCrash.ts, 4, 48)) +>Final : Symbol(Final, Decl(complexClassStructureNoCrash.ts, 9, 87)) +>$Expression : Symbol($Expression, Decl(complexClassStructureNoCrash.ts, 183, 10)) +>S : Symbol(S, Decl(complexClassStructureNoCrash.ts, 232, 19)) + + readonly kind = 'Catch' +>kind : Symbol(Catch.kind, Decl(complexClassStructureNoCrash.ts, 232, 68)) +} diff --git a/tests/baselines/reference/complexClassStructureNoCrash.types b/tests/baselines/reference/complexClassStructureNoCrash.types new file mode 100644 index 0000000000000..cd59e524e1d70 --- /dev/null +++ b/tests/baselines/reference/complexClassStructureNoCrash.types @@ -0,0 +1,608 @@ +=== tests/cases/compiler/complexClassStructureNoCrash.ts === +const { assign } = Object +>assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>Object : ObjectConstructor + +export type Name = string +>Name : string + +export type List = ReadonlyArray +>List : List + +export type Payload = Record +>Payload : Record + +export type Stage = Raw | Filled | Linked +>Stage : Stage + +export abstract class Raw { protected readonly rawTag = 'Raw' } +>Raw : Raw +>rawTag : "Raw" +>'Raw' : "Raw" + +export abstract class Filled extends Raw { protected readonly filledTag = 'Filled' } +>Filled : Filled +>Raw : Raw +>filledTag : "Filled" +>'Filled' : "Filled" + +export abstract class Linked extends Filled { protected readonly linkedTag = 'Linked' } +>Linked : Linked +>Filled : Filled +>linkedTag : "Linked" +>'Linked' : "Linked" + +export type Final = Linked +>Final : Linked + +type Stageable = S extends C ? T : T | undefined +>Stageable : Stageable + +export type Fillable = Stageable +>Fillable : Stageable + +export type Linkable = Stageable +>Linkable : Stageable + +export type Kind = Node['kind'] +>Kind : "Parameter" | "NamedArgument" | "Import" | "Body" | "Catch" | "Package" | "Program" | "Test" | "Describe" | "Class" | "Singleton" | "Mixin" | "Variable" | "Fixture" | "Method" | "Constructor" | "Field" | "Return" | "Assignment" | "Reference" | "Self" | "Send" | "Super" | "New" | "If" | "Throw" | "Try" + +export type Category = 'Entity' | 'Module' | 'Sentence' | 'Expression' +>Category : Category + +export type NodeOfKind = Extract, { kind: K }> +>NodeOfKind : Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> | Extract, { kind: K; }> +>kind : K + +export type NodeOfKindOrCategory = +>NodeOfKindOrCategory : NodeOfKindOrCategory + + Q extends Kind ? NodeOfKind : + never + +export type Node +>Node : Node + + = Parameter + | NamedArgument + | Import + | Body + | Catch + | Entity + | DescribeMember + | ClassMember + | Sentence + +abstract class $Node { +>$Node : $Node + + readonly stage?: S +>stage : S + + abstract readonly kind: Kind +>kind : "Parameter" | "NamedArgument" | "Import" | "Body" | "Catch" | "Package" | "Program" | "Test" | "Describe" | "Class" | "Singleton" | "Mixin" | "Variable" | "Fixture" | "Method" | "Constructor" | "Field" | "Return" | "Assignment" | "Reference" | "Self" | "Send" | "Super" | "New" | "If" | "Throw" | "Try" + + constructor(payload: Record) { +>payload : Record + + assign(this, payload) +>assign(this, payload) : this & Record +>assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } +>this : this +>payload : Record + } + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { +>is : (kindOrCategory: Q) => this is NodeOfKindOrCategory +>kindOrCategory : Q + + return this.kind === kindOrCategory +>this.kind === kindOrCategory : boolean +>this.kind : "Parameter" | "NamedArgument" | "Import" | "Body" | "Catch" | "Package" | "Program" | "Test" | "Describe" | "Class" | "Singleton" | "Mixin" | "Variable" | "Fixture" | "Method" | "Constructor" | "Field" | "Return" | "Assignment" | "Reference" | "Self" | "Send" | "Super" | "New" | "If" | "Throw" | "Try" +>this : this +>kind : "Parameter" | "NamedArgument" | "Import" | "Body" | "Catch" | "Package" | "Program" | "Test" | "Describe" | "Class" | "Singleton" | "Mixin" | "Variable" | "Fixture" | "Method" | "Constructor" | "Field" | "Return" | "Assignment" | "Reference" | "Self" | "Send" | "Super" | "New" | "If" | "Throw" | "Try" +>kindOrCategory : Q + } +} + +export class Parameter extends $Node { +>Parameter : Parameter +>$Node : $Node + + readonly kind = 'Parameter' +>kind : "Parameter" +>'Parameter' : "Parameter" +} + +export class NamedArgument extends $Node { +>NamedArgument : NamedArgument +>$Node : $Node + + readonly kind = 'NamedArgument' +>kind : "NamedArgument" +>'NamedArgument' : "NamedArgument" + + readonly value!: Expression +>value : Expression +} + +export class Import extends $Node { +>Import : Import +>$Node : $Node + + readonly kind = 'Import' +>kind : "Import" +>'Import' : "Import" + + readonly entity!: Reference +>entity : Reference +} + +export class Body extends $Node { +>Body : Body +>$Node : $Node + + readonly kind = 'Body' +>kind : "Body" +>'Body' : "Body" + + readonly sentences!: List> +>sentences : List> +} + +export type Entity +>Entity : Entity + + = Package + | Program + | Test + | Describe + | Module + | Variable + + +export class Package extends $Node { +>Package : Package +>$Node : $Node + + readonly kind = 'Package' +>kind : "Package" +>'Package' : "Package" + + readonly imports!: List> +>imports : List> + + readonly members!: List> +>members : List> +} + +export class Program extends $Node { +>Program : Program +>$Node : $Node + + readonly kind = 'Program' +>kind : "Program" +>'Program' : "Program" + + readonly body!: Body +>body : Body +} + +export class Test extends $Node { +>Test : Test +>$Node : $Node + + readonly kind = 'Test' +>kind : "Test" +>'Test' : "Test" + + readonly body!: Body +>body : Body +} + +export class Describe extends $Node { +>Describe : Describe +>$Node : $Node + + readonly kind = 'Describe' +>kind : "Describe" +>'Describe' : "Describe" + + readonly members!: List> +>members : List> + + tests(): List> { return this.members.filter((member): member is Test => member.is('Test')) } +>tests : () => List> +>this.members.filter((member): member is Test => member.is('Test')) : Test[] +>this.members.filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>this.members : List> +>this : this +>members : List> +>filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>(member): member is Test => member.is('Test') : (member: DescribeMember) => member is Test +>member : DescribeMember +>member.is('Test') : boolean +>member.is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>member : DescribeMember +>is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>'Test' : "Test" + + methods(): List> { return this.members.filter((member): member is Method => member.is('Method')) } +>methods : () => List> +>this.members.filter((member): member is Method => member.is('Method')) : Method[] +>this.members.filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>this.members : List> +>this : this +>members : List> +>filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>(member): member is Method => member.is('Method') : (member: DescribeMember) => member is Method +>member : DescribeMember +>member.is('Method') : boolean +>member.is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>member : DescribeMember +>is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>'Method' : "Method" + + variables(): List> { return this.members.filter((member): member is Variable => member.is('Variable')) } +>variables : () => List> +>this.members.filter((member): member is Variable => member.is('Variable')) : Variable[] +>this.members.filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>this.members : List> +>this : this +>members : List> +>filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>(member): member is Variable => member.is('Variable') : (member: DescribeMember) => member is Variable +>member : DescribeMember +>member.is('Variable') : boolean +>member.is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>member : DescribeMember +>is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>'Variable' : "Variable" + + fixtures(): List> { return this.members.filter((member): member is Fixture => member.is('Fixture')) } +>fixtures : () => List> +>this.members.filter((member): member is Fixture => member.is('Fixture')) : Fixture[] +>this.members.filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>this.members : List> +>this : this +>members : List> +>filter : { >(predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => value is S, thisArg?: any): S[]; (predicate: (value: DescribeMember, index: number, array: readonly DescribeMember[]) => unknown, thisArg?: any): DescribeMember[]; } +>(member): member is Fixture => member.is('Fixture') : (member: DescribeMember) => member is Fixture +>member : DescribeMember +>member.is('Fixture') : boolean +>member.is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>member : DescribeMember +>is : ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) | ((kindOrCategory: Q) => this is NodeOfKindOrCategory) +>'Fixture' : "Fixture" +} + +export class Variable extends $Node { +>Variable : Variable +>$Node : $Node + + readonly kind = 'Variable' +>kind : "Variable" +>'Variable' : "Variable" + + readonly value!: Fillable> +>value : Stageable> + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { +>is : (kindOrCategory: Q) => this is NodeOfKindOrCategory +>kindOrCategory : Q + + return [this.kind, 'Sentence', 'Entity'].includes(kindOrCategory) +>[this.kind, 'Sentence', 'Entity'].includes(kindOrCategory) : boolean +>[this.kind, 'Sentence', 'Entity'].includes : (searchElement: string, fromIndex?: number) => boolean +>[this.kind, 'Sentence', 'Entity'] : string[] +>this.kind : "Variable" +>this : this +>kind : "Variable" +>'Sentence' : "Sentence" +>'Entity' : "Entity" +>includes : (searchElement: string, fromIndex?: number) => boolean +>kindOrCategory : Q + } +} + +export type Module = Class | Singleton | Mixin +>Module : Module + +export class Class extends $Node { +>Class : Class +>$Node : $Node + + readonly kind = 'Class' +>kind : "Class" +>'Class' : "Class" + + readonly mixins!: List> +>mixins : List> + + readonly members!: List> +>members : List> + + readonly superclass!: Fillable | null> +>superclass : Stageable> +>null : null +} + +export class Singleton extends $Node { +>Singleton : Singleton +>$Node : $Node + + readonly kind = 'Singleton' +>kind : "Singleton" +>'Singleton' : "Singleton" + + readonly mixins!: List> +>mixins : List> + + readonly members!: List> +>members : List> + + readonly superCall!: FillablesuperCall : Stageable; args: List> | List>; }> + + superclass: Reference, +>superclass : Reference + + args: List> | List> +>args : List> | List> + + }> +} + +export class Mixin extends $Node { +>Mixin : Mixin +>$Node : $Node + + readonly kind = 'Mixin' +>kind : "Mixin" +>'Mixin' : "Mixin" + + readonly mixins!: List> +>mixins : List> + + readonly members!: List> +>members : List> +} + +export type ObjectMember = Field | Method +>ObjectMember : ObjectMember + +export type ClassMember = Constructor | ObjectMember +>ClassMember : ClassMember + +export type DescribeMember = Variable | Fixture | Test | Method +>DescribeMember : DescribeMember + +export class Field extends $Node { +>Field : Field +>$Node : $Node + + readonly kind = 'Field' +>kind : "Field" +>'Field' : "Field" + + readonly value!: Fillable> +>value : Stageable> +} + +export class Method extends $Node { +>Method : Method +>$Node : $Node + + readonly kind = 'Method' +>kind : "Method" +>'Method' : "Method" + + readonly parameters!: List> +>parameters : List> + + readonly body?: Body +>body : Body +} + +export class Constructor extends $Node { +>Constructor : Constructor +>$Node : $Node + + readonly kind = 'Constructor' +>kind : "Constructor" +>'Constructor' : "Constructor" + + readonly parameters!: List> +>parameters : List> + + readonly body!: Body +>body : Body + + readonly baseCall?: { callsSuper: boolean, args: List> } +>baseCall : { callsSuper: boolean; args: List>; } +>callsSuper : boolean +>args : List> +} + +export class Fixture extends $Node { +>Fixture : Fixture +>$Node : $Node + + readonly kind = 'Fixture' +>kind : "Fixture" +>'Fixture' : "Fixture" + + readonly body!: Body +>body : Body +} + +export type Sentence = Variable | Return | Assignment | Expression +>Sentence : Sentence + +export class Return extends $Node { +>Return : Return +>$Node : $Node + + readonly kind = 'Return' +>kind : "Return" +>'Return' : "Return" + + readonly value?: Expression +>value : Expression +} + +export class Assignment extends $Node { +>Assignment : Assignment +>$Node : $Node + + readonly kind = 'Assignment' +>kind : "Assignment" +>'Assignment' : "Assignment" + + readonly variable!: Reference +>variable : Reference + + readonly value!: Expression +>value : Expression +} + +export type Expression +>Expression : Expression + + = Reference + | Self + | Send + | Super + | New + | If + | Throw + | Try + +abstract class $Expression extends $Node { +>$Expression : $Expression +>$Node : $Node + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { +>is : (kindOrCategory: Q) => this is NodeOfKindOrCategory +>kindOrCategory : Q + + return kindOrCategory === 'Expression' || super.is(kindOrCategory) +>kindOrCategory === 'Expression' || super.is(kindOrCategory) : boolean +>kindOrCategory === 'Expression' : boolean +>kindOrCategory : Q +>'Expression' : "Expression" +>super.is(kindOrCategory) : boolean +>super.is : (kindOrCategory: Q) => this is NodeOfKindOrCategory +>super : $Node +>is : (kindOrCategory: Q) => this is NodeOfKindOrCategory +>kindOrCategory : Q + } +} + +export class Reference extends $Expression { +>Reference : Reference +>$Expression : $Expression + + readonly kind = 'Reference' +>kind : "Reference" +>'Reference' : "Reference" + + readonly name!: Name +>name : string +} + +export class Self extends $Expression { +>Self : Self +>$Expression : $Expression + + readonly kind = 'Self' +>kind : "Self" +>'Self' : "Self" +} + +export class Send extends $Expression { +>Send : Send +>$Expression : $Expression + + readonly kind = 'Send' +>kind : "Send" +>'Send' : "Send" + + readonly receiver!: Expression +>receiver : Expression + + readonly message!: Name +>message : string + + readonly args!: List> +>args : List> +} + +export class Super extends $Expression { +>Super : Super +>$Expression : $Expression + + readonly kind = 'Super' +>kind : "Super" +>'Super' : "Super" + + readonly args!: List> +>args : List> +} + +export class New extends $Expression { +>New : New +>$Expression : $Expression + + readonly kind = 'New' +>kind : "New" +>'New' : "New" + + readonly instantiated!: Reference +>instantiated : Reference + + readonly args!: List> | List> +>args : List> | List> +} + +export class If extends $Expression { +>If : If +>$Expression : $Expression + + readonly kind = 'If' +>kind : "If" +>'If' : "If" + + readonly thenBody!: Body +>thenBody : Body + + readonly elseBody!: Fillable> +>elseBody : Stageable> +} + +export class Throw extends $Expression { +>Throw : Throw +>$Expression : $Expression + + readonly kind = 'Throw' +>kind : "Throw" +>'Throw' : "Throw" +} + +export class Try extends $Expression { +>Try : Try +>$Expression : $Expression + + readonly kind = 'Try' +>kind : "Try" +>'Try' : "Try" +} + +export class Catch extends $Expression { +>Catch : Catch +>$Expression : $Expression + + readonly kind = 'Catch' +>kind : "Catch" +>'Catch' : "Catch" +} diff --git a/tests/baselines/reference/errorElaboration.errors.txt b/tests/baselines/reference/errorElaboration.errors.txt index 30c4fe8efd64b..b33f7d59ad17a 100644 --- a/tests/baselines/reference/errorElaboration.errors.txt +++ b/tests/baselines/reference/errorElaboration.errors.txt @@ -1,8 +1,12 @@ tests/cases/compiler/errorElaboration.ts(10,18): error TS2300: Duplicate identifier 'foo'. tests/cases/compiler/errorElaboration.ts(12,5): error TS2345: Argument of type '() => Container>' is not assignable to parameter of type '() => Container>'. - Type 'Container>' is not assignable to type 'Container>'. - Type 'Ref' is not assignable to type 'Ref'. - Type 'string' is not assignable to type 'number'. + Call signature return types 'Container>' and 'Container>' are incompatible. + The types of 'm1.m1.m1.m2' are incompatible between these types. + Type 'Ref>>>' is not assignable to type 'Ref>>>'. + Type 'Ref>>' is not assignable to type 'Ref>>'. + Type 'Ref>' is not assignable to type 'Ref>'. + Type 'Ref' is not assignable to type 'Ref'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/errorElaboration.ts(17,11): error TS2322: Type '"bar"' is not assignable to type '"foo"'. tests/cases/compiler/errorElaboration.ts(22,7): error TS2300: Duplicate identifier 'foo'. tests/cases/compiler/errorElaboration.ts(23,15): error TS2538: Type 'any' cannot be used as an index type. @@ -26,9 +30,13 @@ tests/cases/compiler/errorElaboration.ts(23,19): error TS2339: Property 'bar' do foo(a); ~ !!! error TS2345: Argument of type '() => Container>' is not assignable to parameter of type '() => Container>'. -!!! error TS2345: Type 'Container>' is not assignable to type 'Container>'. -!!! error TS2345: Type 'Ref' is not assignable to type 'Ref'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2345: Call signature return types 'Container>' and 'Container>' are incompatible. +!!! error TS2345: The types of 'm1.m1.m1.m2' are incompatible between these types. +!!! error TS2345: Type 'Ref>>>' is not assignable to type 'Ref>>>'. +!!! error TS2345: Type 'Ref>>' is not assignable to type 'Ref>>'. +!!! error TS2345: Type 'Ref>' is not assignable to type 'Ref>'. +!!! error TS2345: Type 'Ref' is not assignable to type 'Ref'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. // Repro for #25498 diff --git a/tests/baselines/reference/genericCloneReturnTypes.errors.txt b/tests/baselines/reference/genericCloneReturnTypes.errors.txt index 0e54ebc02cff2..ecbf301429589 100644 --- a/tests/baselines/reference/genericCloneReturnTypes.errors.txt +++ b/tests/baselines/reference/genericCloneReturnTypes.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/genericCloneReturnTypes.ts(25,1): error TS2322: Type 'Bar' is not assignable to type 'Bar'. - Type 'string' is not assignable to type 'number'. + Types of property 't' are incompatible. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/genericCloneReturnTypes.ts (1 errors) ==== @@ -30,4 +31,5 @@ tests/cases/compiler/genericCloneReturnTypes.ts(25,1): error TS2322: Type 'Bar' is not assignable to type 'Bar'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Types of property 't' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt index 582d7719a8976..e70e142573428 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty.ts(13,1): error TS2322: Type 'List' is not assignable to type 'List'. - Type 'string' is not assignable to type 'number'. + Types of property 'data' are incompatible. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty.ts (1 errors) ==== @@ -18,4 +19,5 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec list1 = list3; // error ~~~~~ !!! error TS2322: Type 'List' is not assignable to type 'List'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Types of property 'data' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt index 6349a4528213a..a3905028d0dff 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedProperty2.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty2.ts(13,1): error TS2322: Type 'List' is not assignable to type 'List'. - Type 'string' is not assignable to type 'number'. + Types of property 'data' are incompatible. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedProperty2.ts (1 errors) ==== @@ -18,4 +19,5 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec list1 = list3; // error ~~~~~ !!! error TS2322: Type 'List' is not assignable to type 'List'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Types of property 'data' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt index 8f2ebf0131a84..72093dab99e9a 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt @@ -15,7 +15,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(42,5): error TS2322: Type 'U' is not assignable to type 'T'. 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. Type 'MyList' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'MyList'. + 'MyList' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts (5 errors) ==== @@ -83,7 +83,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec !!! error TS2322: Type 'U' is not assignable to type 'T'. !!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. !!! error TS2322: Type 'MyList' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'MyList'. +!!! error TS2322: 'MyList' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. u = t; // was error, ok after constraint made illegal, doesn't matter var a: List; diff --git a/tests/baselines/reference/privateNamesInGenericClasses.errors.txt b/tests/baselines/reference/privateNamesInGenericClasses.errors.txt index d617432535020..31bdf0eeea51e 100644 --- a/tests/baselines/reference/privateNamesInGenericClasses.errors.txt +++ b/tests/baselines/reference/privateNamesInGenericClasses.errors.txt @@ -1,8 +1,10 @@ tests/cases/conformance/classes/members/privateNames/privateNamesInGenericClasses.ts(10,3): error TS18013: Property '#foo' is not accessible outside class 'C' because it has a private identifier. tests/cases/conformance/classes/members/privateNames/privateNamesInGenericClasses.ts(11,1): error TS2322: Type 'C' is not assignable to type 'C'. - Type 'string' is not assignable to type 'number'. + Types of property '#foo' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/classes/members/privateNames/privateNamesInGenericClasses.ts(12,1): error TS2322: Type 'C' is not assignable to type 'C'. - Type 'number' is not assignable to type 'string'. + Types of property '#foo' are incompatible. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/classes/members/privateNames/privateNamesInGenericClasses.ts (3 errors) ==== @@ -21,9 +23,11 @@ tests/cases/conformance/classes/members/privateNames/privateNamesInGenericClasse a = b; // Error ~ !!! error TS2322: Type 'C' is not assignable to type 'C'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Types of property '#foo' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. b = a; // Error ~ !!! error TS2322: Type 'C' is not assignable to type 'C'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Types of property '#foo' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt index 6c76d41809a98..7ccc1d2790686 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt +++ b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt @@ -2,12 +2,14 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(8,12): error TS2504: Type 'Promise' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(10,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. - The types returned by 'next(...)' are incompatible between these types. - Type 'Promise>' is not assignable to type 'Promise>'. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'string' is not assignable to type 'number'. + The types of 'next(...).then' are incompatible between these types. + Type ', TResult2 = never>(onfulfilled?: (value: IteratorResult) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise' is not assignable to type ', TResult2 = never>(onfulfilled?: (value: IteratorResult) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise'. + Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. + Types of parameters 'value' and 'value' are incompatible. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(13,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(16,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. @@ -67,12 +69,14 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. !!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. -!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. -!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. -!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: The types of 'next(...).then' are incompatible between these types. +!!! error TS2322: Type ', TResult2 = never>(onfulfilled?: (value: IteratorResult) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise' is not assignable to type ', TResult2 = never>(onfulfilled?: (value: IteratorResult) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise'. +!!! error TS2322: Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible. +!!! error TS2322: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield "a"; }; const assignability2: () => AsyncIterableIterator = async function * () { diff --git a/tests/baselines/reference/varianceMeasurement.errors.txt b/tests/baselines/reference/varianceMeasurement.errors.txt index eb77b28564669..523a0d9457a27 100644 --- a/tests/baselines/reference/varianceMeasurement.errors.txt +++ b/tests/baselines/reference/varianceMeasurement.errors.txt @@ -1,5 +1,11 @@ tests/cases/compiler/varianceMeasurement.ts(10,7): error TS2322: Type 'Foo1' is not assignable to type 'Foo1<"a">'. - Type 'string' is not assignable to type '"a"'. + Types of property 'x' are incompatible. + Type 'string' is not assignable to type '"a"'. +tests/cases/compiler/varianceMeasurement.ts(11,7): error TS2322: Type 'Foo1' is not assignable to type 'Foo1'. + The types of 'y.x' are incompatible between these types. + Type '(arg: string) => void' is not assignable to type '(arg: unknown) => void'. + Types of parameters 'arg' and 'arg' are incompatible. + Type 'unknown' is not assignable to type 'string'. tests/cases/compiler/varianceMeasurement.ts(21,7): error TS2322: Type 'Foo2' is not assignable to type 'Foo2<"a">'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '"a"'. @@ -9,7 +15,13 @@ tests/cases/compiler/varianceMeasurement.ts(22,7): error TS2322: Type 'Foo2' is not assignable to type 'Foo3<"a">'. - Type 'string' is not assignable to type '"a"'. + Types of property 'x' are incompatible. + Type 'string' is not assignable to type '"a"'. +tests/cases/compiler/varianceMeasurement.ts(34,7): error TS2322: Type 'Foo3' is not assignable to type 'Foo3'. + The types of 'y.x' are incompatible between these types. + Type '(arg: string) => void' is not assignable to type '(arg: unknown) => void'. + Types of parameters 'arg' and 'arg' are incompatible. + Type 'unknown' is not assignable to type 'string'. tests/cases/compiler/varianceMeasurement.ts(44,7): error TS2322: Type 'Foo4' is not assignable to type 'Foo4<"a">'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '"a"'. @@ -19,12 +31,15 @@ tests/cases/compiler/varianceMeasurement.ts(45,7): error TS2322: Type 'Foo4' is not assignable to type 'Fn'. - Type 'unknown' is not assignable to type 'string'. + The types returned by 'then(...)' are incompatible between these types. + Type 'Fn' is not assignable to type 'Fn'. + Types of parameters 'a' and 'a' are incompatible. + Type 'unknown' is not assignable to type 'string'. tests/cases/compiler/varianceMeasurement.ts(62,7): error TS2322: Type 'Fn' is not assignable to type 'Fn'. Type 'number' is not assignable to type '0'. -==== tests/cases/compiler/varianceMeasurement.ts (8 errors) ==== +==== tests/cases/compiler/varianceMeasurement.ts (10 errors) ==== // The type below should be invariant in T but is measured as covariant because // we don't analyze recursive references. @@ -37,8 +52,15 @@ tests/cases/compiler/varianceMeasurement.ts(62,7): error TS2322: Type 'Fn = f10; ~~~ !!! error TS2322: Type 'Foo1' is not assignable to type 'Foo1<"a">'. -!!! error TS2322: Type 'string' is not assignable to type '"a"'. +!!! error TS2322: Types of property 'x' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type '"a"'. const f12: Foo1 = f10; + ~~~ +!!! error TS2322: Type 'Foo1' is not assignable to type 'Foo1'. +!!! error TS2322: The types of 'y.x' are incompatible between these types. +!!! error TS2322: Type '(arg: string) => void' is not assignable to type '(arg: unknown) => void'. +!!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. // The type below is invariant in T and is measured as such. @@ -73,8 +95,15 @@ tests/cases/compiler/varianceMeasurement.ts(62,7): error TS2322: Type 'Fn = f30; ~~~ !!! error TS2322: Type 'Foo3' is not assignable to type 'Foo3<"a">'. -!!! error TS2322: Type 'string' is not assignable to type '"a"'. +!!! error TS2322: Types of property 'x' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type '"a"'. const f32: Foo3 = f30; + ~~~ +!!! error TS2322: Type 'Foo3' is not assignable to type 'Foo3'. +!!! error TS2322: The types of 'y.x' are incompatible between these types. +!!! error TS2322: Type '(arg: string) => void' is not assignable to type '(arg: unknown) => void'. +!!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. // The type below is invariant in T and is measured as such. @@ -110,7 +139,10 @@ tests/cases/compiler/varianceMeasurement.ts(62,7): error TS2322: Type 'Fn = fn; // Error ~~~ !!! error TS2322: Type 'Fn' is not assignable to type 'Fn'. -!!! error TS2322: Type 'unknown' is not assignable to type 'string'. +!!! error TS2322: The types returned by 'then(...)' are incompatible between these types. +!!! error TS2322: Type 'Fn' is not assignable to type 'Fn'. +!!! error TS2322: Types of parameters 'a' and 'a' are incompatible. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. const fn2: Fn<'a', number> = fn; // Covariant in B diff --git a/tests/cases/compiler/complexClassStructureNoCrash.ts b/tests/cases/compiler/complexClassStructureNoCrash.ts new file mode 100644 index 0000000000000..58f3fd1ef8656 --- /dev/null +++ b/tests/cases/compiler/complexClassStructureNoCrash.ts @@ -0,0 +1,236 @@ +// @target: esnext +const { assign } = Object + +export type Name = string +export type List = ReadonlyArray +export type Payload = Record + +export type Stage = Raw | Filled | Linked +export abstract class Raw { protected readonly rawTag = 'Raw' } +export abstract class Filled extends Raw { protected readonly filledTag = 'Filled' } +export abstract class Linked extends Filled { protected readonly linkedTag = 'Linked' } +export type Final = Linked + +type Stageable = S extends C ? T : T | undefined +export type Fillable = Stageable +export type Linkable = Stageable + +export type Kind = Node['kind'] +export type Category = 'Entity' | 'Module' | 'Sentence' | 'Expression' +export type NodeOfKind = Extract, { kind: K }> +export type NodeOfKindOrCategory = + Q extends Kind ? NodeOfKind : + never + +export type Node + = Parameter + | NamedArgument + | Import + | Body + | Catch + | Entity + | DescribeMember + | ClassMember + | Sentence + +abstract class $Node { + readonly stage?: S + abstract readonly kind: Kind + + constructor(payload: Record) { + assign(this, payload) + } + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { + return this.kind === kindOrCategory + } +} + +export class Parameter extends $Node { + readonly kind = 'Parameter' +} + +export class NamedArgument extends $Node { + readonly kind = 'NamedArgument' + readonly value!: Expression +} + +export class Import extends $Node { + readonly kind = 'Import' + readonly entity!: Reference +} + +export class Body extends $Node { + readonly kind = 'Body' + readonly sentences!: List> +} + +export type Entity + = Package + | Program + | Test + | Describe + | Module + | Variable + + +export class Package extends $Node { + readonly kind = 'Package' + readonly imports!: List> + readonly members!: List> +} + +export class Program extends $Node { + readonly kind = 'Program' + readonly body!: Body +} + +export class Test extends $Node { + readonly kind = 'Test' + readonly body!: Body +} + +export class Describe extends $Node { + readonly kind = 'Describe' + readonly members!: List> + + tests(): List> { return this.members.filter((member): member is Test => member.is('Test')) } + methods(): List> { return this.members.filter((member): member is Method => member.is('Method')) } + variables(): List> { return this.members.filter((member): member is Variable => member.is('Variable')) } + fixtures(): List> { return this.members.filter((member): member is Fixture => member.is('Fixture')) } +} + +export class Variable extends $Node { + readonly kind = 'Variable' + readonly value!: Fillable> + + is(kindOrCategory: Q): this is NodeOfKindOrCategory { + return [this.kind, 'Sentence', 'Entity'].includes(kindOrCategory) + } +} + +export type Module = Class | Singleton | Mixin + +export class Class extends $Node { + readonly kind = 'Class' + readonly mixins!: List> + readonly members!: List> + readonly superclass!: Fillable | null> +} + +export class Singleton extends $Node { + readonly kind = 'Singleton' + readonly mixins!: List> + readonly members!: List> + readonly superCall!: Fillable, + args: List> | List> + }> +} + +export class Mixin extends $Node { + readonly kind = 'Mixin' + readonly mixins!: List> + readonly members!: List> +} + +export type ObjectMember = Field | Method +export type ClassMember = Constructor | ObjectMember +export type DescribeMember = Variable | Fixture | Test | Method + +export class Field extends $Node { + readonly kind = 'Field' + readonly value!: Fillable> +} + +export class Method extends $Node { + readonly kind = 'Method' + readonly parameters!: List> + readonly body?: Body +} + +export class Constructor extends $Node { + readonly kind = 'Constructor' + readonly parameters!: List> + readonly body!: Body + readonly baseCall?: { callsSuper: boolean, args: List> } +} + +export class Fixture extends $Node { + readonly kind = 'Fixture' + readonly body!: Body +} + +export type Sentence = Variable | Return | Assignment | Expression + +export class Return extends $Node { + readonly kind = 'Return' + readonly value?: Expression +} + +export class Assignment extends $Node { + readonly kind = 'Assignment' + readonly variable!: Reference + readonly value!: Expression +} + +export type Expression + = Reference + | Self + | Send + | Super + | New + | If + | Throw + | Try + +abstract class $Expression extends $Node { + is(kindOrCategory: Q): this is NodeOfKindOrCategory { + return kindOrCategory === 'Expression' || super.is(kindOrCategory) + } +} + +export class Reference extends $Expression { + readonly kind = 'Reference' + readonly name!: Name +} + +export class Self extends $Expression { + readonly kind = 'Self' +} + +export class Send extends $Expression { + readonly kind = 'Send' + readonly receiver!: Expression + readonly message!: Name + readonly args!: List> +} + +export class Super extends $Expression { + readonly kind = 'Super' + readonly args!: List> +} + +export class New extends $Expression { + readonly kind = 'New' + readonly instantiated!: Reference + readonly args!: List> | List> +} + +export class If extends $Expression { + readonly kind = 'If' + readonly thenBody!: Body + readonly elseBody!: Fillable> +} + +export class Throw extends $Expression { + readonly kind = 'Throw' +} + +export class Try extends $Expression { + readonly kind = 'Try' +} + +export class Catch extends $Expression { + readonly kind = 'Catch' +} \ No newline at end of file