From a88a16d2a9958d46ae0ad871914c9842a232d03e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 4 Apr 2024 10:34:02 -0700 Subject: [PATCH 1/5] Always consider parameters in scope visible to node builder --- src/compiler/checker.ts | 11 +++++ ...eOverloadsCausedByOverloadResolution.types | 20 ++++----- ...xtualComputedNonBindablePropertyType.types | 4 +- .../contextualTypeSelfReferencing.types | 2 +- .../cyclicGenericTypeInstantiation.types | 8 ++-- ...licGenericTypeInstantiationInference.types | 8 ++-- .../reference/cyclicTypeInstantiation.types | 8 ++-- .../genericsManyTypeParameters.types | 2 +- .../reference/inferenceAndHKTs.types | 2 +- .../mappedTypeRecursiveInference2.types | 2 +- ...als_typeParameterMergedWithParameter.types | 4 +- ...amingDestructuredPropertyInFunctionType.js | 6 +-- ...ngDestructuredPropertyInFunctionType.types | 28 ++++++------ .../subtypingWithCallSignatures.types | 8 ++-- .../subtypingWithCallSignatures3.types | 44 +++++++++---------- .../subtypingWithConstructSignatures.types | 8 ++-- .../subtypingWithConstructSignatures3.types | 44 +++++++++---------- .../typeParameterAndArgumentOfSameName1.types | 2 +- 18 files changed, 111 insertions(+), 100 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 827f04bcc4583..ea2a9e200d1f2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8670,6 +8670,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const meaning = getMeaningOfEntityNameReference(node); const sym = resolveEntityName(leftmost, meaning, /*ignoreErrors*/ true, /*dontResolveAlias*/ true); if (sym) { + // If a parameter is resolvable in the current context it is also visible, so no need to go to symbol accesibility + if ( + sym.flags & SymbolFlags.FunctionScopedVariable + && sym.valueDeclaration + ) { + const parameter = sym.valueDeclaration.kind === SyntaxKind.Parameter ? sym.valueDeclaration : + findAncestor(sym.valueDeclaration, n => n.kind === SyntaxKind.Parameter || context.enclosingDeclaration === n.parent); + if (parameter) { + return { introducesError, node }; + } + } if (isSymbolAccessible(sym, context.enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ false).accessibility !== SymbolAccessibility.Accessible) { if (!isDeclarationName(node)) { introducesError = true; diff --git a/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types b/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types index 053165a4d41e6..9aacb0c09a748 100644 --- a/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types +++ b/tests/baselines/reference/conditionallyDuplicateOverloadsCausedByOverloadResolution.types @@ -28,24 +28,24 @@ var out = foo((x, y) => { > : ^^^^^^^ >foo : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->(x, y) => { function bar(a: typeof x): void; function bar(b: typeof y): void; function bar() { } return bar;} : (x: string, y: string) => { (a: string): void; (b: string): void; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^ +>(x, y) => { function bar(a: typeof x): void; function bar(b: typeof y): void; function bar() { } return bar;} : (x: string, y: string) => { (a: typeof x): void; (b: typeof y): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^ ^^^ ^^^ >x : string > : ^^^^^^ >y : string > : ^^^^^^ function bar(a: typeof x): void; ->bar : { (a: string): void; (b: string): void; } -> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ +>bar : { (a: typeof x): void; (b: string): void; } +> : ^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^ >a : string > : ^^^^^^ >x : string > : ^^^^^^ function bar(b: typeof y): void; ->bar : { (a: string): void; (b: string): void; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ +>bar : { (a: string): void; (b: typeof y): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ >b : string > : ^^^^^^ >y : string @@ -88,16 +88,16 @@ var out2 = foo2((x, y) => { > : ^^^^^^^ >foo2 : { (func: (x: string, y: string) => any): boolean; (func: (x: string, y: number) => any): string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->(x, y) => { var bar: { (a: typeof x): void; (b: typeof y): void; }; return bar;} : (x: string, y: string) => { (a: string): void; (b: string): void; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^ +>(x, y) => { var bar: { (a: typeof x): void; (b: typeof y): void; }; return bar;} : (x: string, y: string) => { (a: typeof x): void; (b: typeof y): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^ ^^^ ^^^ >x : string > : ^^^^^^ >y : string > : ^^^^^^ var bar: { ->bar : { (a: string): void; (b: string): void; } -> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^ +>bar : { (a: typeof x): void; (b: typeof y): void; } +> : ^^^^^^ ^^^ ^^^^^^ ^^^ ^^^ (a: typeof x): void; >a : string diff --git a/tests/baselines/reference/contextualComputedNonBindablePropertyType.types b/tests/baselines/reference/contextualComputedNonBindablePropertyType.types index bc073d48ff53e..2c2f652104344 100644 --- a/tests/baselines/reference/contextualComputedNonBindablePropertyType.types +++ b/tests/baselines/reference/contextualComputedNonBindablePropertyType.types @@ -95,9 +95,9 @@ type Mapped = { const propSelector = (propName: propName): propName => propName; >propSelector : (propName: propName) => propName -> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >(propName: propName): propName => propName : (propName: propName) => propName -> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >propName : propName > : ^^^^^^^^ >propName : propName diff --git a/tests/baselines/reference/contextualTypeSelfReferencing.types b/tests/baselines/reference/contextualTypeSelfReferencing.types index d98cff6c03dc6..530113057539a 100644 --- a/tests/baselines/reference/contextualTypeSelfReferencing.types +++ b/tests/baselines/reference/contextualTypeSelfReferencing.types @@ -16,7 +16,7 @@ type narrow = def extends string declare const parse: (def: narrow) => def; >parse : (def: narrow) => def -> : ^ ^^^^^^^ ^^^^^ +> : ^^^^^^^^^^^ ^^^^^ >def : narrow > : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiation.types b/tests/baselines/reference/cyclicGenericTypeInstantiation.types index 191119a1e13d8..25b41e7b10ddd 100644 --- a/tests/baselines/reference/cyclicGenericTypeInstantiation.types +++ b/tests/baselines/reference/cyclicGenericTypeInstantiation.types @@ -2,8 +2,8 @@ === cyclicGenericTypeInstantiation.ts === function foo() { ->foo : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>foo : () => { y2: typeof z; } +> : ^^^^^^^^^^^^^^^ ^^^ var z = foo(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } @@ -33,8 +33,8 @@ function foo() { function bar() { ->bar : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>bar : () => { y2: typeof z; } +> : ^^^^^^^^^^^^^^^ ^^^ var z = bar(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types index da10cb7952070..ff8ee04fe63af 100644 --- a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types +++ b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types @@ -2,8 +2,8 @@ === cyclicGenericTypeInstantiationInference.ts === function foo() { ->foo : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>foo : () => { y2: typeof z; } +> : ^^^^^^^^^^^^^^^ ^^^ var z = foo(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } @@ -33,8 +33,8 @@ function foo() { function bar() { ->bar : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>bar : () => { y2: typeof z; } +> : ^^^^^^^^^^^^^^^ ^^^ var z = bar(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } diff --git a/tests/baselines/reference/cyclicTypeInstantiation.types b/tests/baselines/reference/cyclicTypeInstantiation.types index c4072505818fb..63f7724a072ad 100644 --- a/tests/baselines/reference/cyclicTypeInstantiation.types +++ b/tests/baselines/reference/cyclicTypeInstantiation.types @@ -2,8 +2,8 @@ === cyclicTypeInstantiation.ts === function foo() { ->foo : () => { a: T; b: any; } -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^^ +>foo : () => { a: T; b: typeof x; } +> : ^ ^^^^^^^^^^^^ ^^^^^ ^^^ var x: { >x : { a: T; b: any; } @@ -26,8 +26,8 @@ function foo() { } function bar() { ->bar : () => { a: T; b: any; } -> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^^ +>bar : () => { a: T; b: typeof x; } +> : ^ ^^^^^^^^^^^^ ^^^^^ ^^^ var x: { >x : { a: T; b: any; } diff --git a/tests/baselines/reference/genericsManyTypeParameters.types b/tests/baselines/reference/genericsManyTypeParameters.types index afbc172e562ef..84867fcbc0d74 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.types +++ b/tests/baselines/reference/genericsManyTypeParameters.types @@ -8,7 +8,7 @@ Symbol count: 25,500 / 25,500 (nearest 500) === genericsManyTypeParameters.ts === function Foo< >Foo : (x1: a1, y1: a21, z1: a31, a1: a41, b1: a51, c1: a61, x2: a119, y2: a22, z2: a32, a2: a42, b2: a52, c2: a62, x3: a219, y3: a23, z3: a33, a3: a43, b3: a53, c3: a63, x4: a319, y4: a24, z4: a34, a4: a44, b4: a54, c4: a64, x5: a419, y5: a25, z5: a35, a5: a45, b5: a55, c5: a65, x6: a519, y6: a26, z6: a36, a6: a46, b6: a56, c6: a66, x7: a619, y7: a27, z7: a37, a7: a47, b7: a57, c7: a67, x8: a71, y8: a28, z8: a38, a8: a48, b8: a58, c8: a68, x9: a81, y9: a29, z9: a39, a9: a49, b9: a59, c9: a69, x10: a91, y12: a210, z10: a310, a10: a410, b10: a510, c10: a610, x11: a111, y13: a211, z11: a311, a11: a411, b11: a511, c11: a611, x12: a112, y14: a212, z12: a312, a12: a412, b12: a512, c12: a612, x13: a113, y15: a213, z13: a313, a13: a413, b13: a513, c13: a613, x14: a114, y16: a214, z14: a314, a14: a414, b14: a514, c14: a614, x15: a115, y17: a215, z15: a315, a15: a415, b15: a515, c15: a615, x16: a116, y18: a216, z16: a316, a16: a416, b16: a516, c16: a616, x17: a117, y19: a217, z17: a317, a17: a417, b17: a517, c17: a617, x18: a118, y10: a218, z18: a318, a18: a418, b18: a518, c18: a618) => (a1 | a21 | a31 | a41 | a51 | a61 | a119 | a22 | a32 | a42 | a52 | a62 | a219 | a23 | a33 | a43 | a53 | a63 | a319 | a24 | a34 | a44 | a54 | a64 | a419 | a25 | a35 | a45 | a55 | a65 | a519 | a26 | a36 | a46 | a56 | a66 | a619 | a27 | a37 | a47 | a57 | a67 | a71 | a28 | a38 | a48 | a58 | a68 | a81 | a29 | a39 | a49 | a59 | a69 | a91 | a210 | a310 | a410 | a510 | a610 | a111 | a211 | a311 | a411 | a511 | a611 | a112 | a212 | a312 | a412 | a512 | a612 | a113 | a213 | a313 | a413 | a513 | a613 | a114 | a214 | a314 | a414 | a514 | a614 | a115 | a215 | a315 | a415 | a515 | a615 | a116 | a216 | a316 | a416 | a516 | a616 | a117 | a217 | a317 | a417 | a517 | a617 | a118 | a218 | a318 | a418 | a518 | a618)[] -> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ 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^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a1, a21, a31, a41, a51, a61, a119, a22, a32, a42, a52, a62, diff --git a/tests/baselines/reference/inferenceAndHKTs.types b/tests/baselines/reference/inferenceAndHKTs.types index dc67d34d219b2..1159749bae692 100644 --- a/tests/baselines/reference/inferenceAndHKTs.types +++ b/tests/baselines/reference/inferenceAndHKTs.types @@ -45,7 +45,7 @@ export interface TTypeLambda extends TypeLambda { export declare const map: (F: TypeClass) => (a: Apply, f: (a: A) => B) => Apply; >map : (F: TypeClass) => (a: Apply, f: (a: A) => B) => Apply -> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >F : TypeClass > : ^^^^^^^^^^^^ >a : Apply diff --git a/tests/baselines/reference/mappedTypeRecursiveInference2.types b/tests/baselines/reference/mappedTypeRecursiveInference2.types index f05d7696c796d..f5dafb1b47c49 100644 --- a/tests/baselines/reference/mappedTypeRecursiveInference2.types +++ b/tests/baselines/reference/mappedTypeRecursiveInference2.types @@ -26,7 +26,7 @@ type validateDefinition = def extends MorphTuple declare function type(def: validateDefinition): def >type : (def: validateDefinition) => def -> : ^ ^^^^^^^ ^^^^^ +> : ^^^^^^^^^^^ ^^^^^ >def : validateDefinition > : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types b/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types index b16e1e36fdec8..247257ab95249 100644 --- a/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types +++ b/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types @@ -20,13 +20,13 @@ function useParam(T: number) { function useTypeParam(T: T) {} >useTypeParam : (T: T) => void -> : ^ ^^^^^ ^^^^^^^^^ +> : ^^^^^^^ ^^^^^^^^^ >T : T > : ^ function useBoth(T: T) { >useBoth : (T: T) => T -> : ^ ^^^^^ ^^^^^^ +> : ^^^^^^^ ^^^^^^ >T : T > : ^ diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js index af19e36e72147..f24c417f4dd5c 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.js @@ -171,13 +171,13 @@ interface I { declare function f1({ a: string }: O): void; declare const f2: ({ a: string }: O) => void; declare const f3: ({ a: string, b, c }: O) => void; -declare const f4: ({ a: string }: O) => string; -declare const f5: ({ a: string, b, c }: O) => string; +declare const f4: ({ a: string }: O) => typeof string; +declare const f5: ({ a: string, b, c }: O) => typeof string; declare const obj1: { method({ a: string }: O): void; }; declare const obj2: { - method({ a: string }: O): string; + method({ a: string }: O): typeof string; }; declare function f6({ a: string }: O): void; declare const f7: ({ a: string, b, c }: O) => void; diff --git a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types index 6e32c4f4f26a7..bc5c6edd658b7 100644 --- a/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types +++ b/tests/baselines/reference/renamingDestructuredPropertyInFunctionType.types @@ -325,10 +325,10 @@ const f3 = ({ a: string, b, c }: O) => { }; > : ^^^^^^ const f4 = function({ a: string }: O): typeof string { return string; }; ->f4 : ({ a: string }: O) => string -> : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ->function({ a: string }: O): typeof string { return string; } : ({ a: string }: O) => string -> : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ +>f4 : ({ a: string }: O) => typeof string +> : ^^^^^^^^^^^^^^^^ ^^^^^ +>function({ a: string }: O): typeof string { return string; } : ({ a: string }: O) => typeof string +> : ^^^^^^^^^^^^^^^^ ^^^^^ >a : any > : ^^^ >string : string @@ -339,10 +339,10 @@ const f4 = function({ a: string }: O): typeof string { return string; }; > : ^^^^^^ const f5 = ({ a: string, b, c }: O): typeof string => ''; ->f5 : ({ a: string, b, c }: O) => string -> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ->({ a: string, b, c }: O): typeof string => '' : ({ a: string, b, c }: O) => string -> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ +>f5 : ({ a: string, b, c }: O) => typeof string +> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ +>({ a: string, b, c }: O): typeof string => '' : ({ a: string, b, c }: O) => typeof string +> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >a : any > : ^^^ >string : string @@ -372,14 +372,14 @@ const obj1 = { }; const obj2 = { ->obj2 : { method({ a: string }: O): string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ->{ method({ a: string }: O): typeof string { return string; }} : { method({ a: string }: O): string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ +>obj2 : { method({ a: string }: O): typeof string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ +>{ method({ a: string }: O): typeof string { return string; }} : { method({ a: string }: O): typeof string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ method({ a: string }: O): typeof string { return string; } ->method : ({ a: string }: O) => string -> : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ +>method : ({ a: string }: O) => typeof string +> : ^^^^^^^^^^^^^^^^ ^^^^^ >a : any > : ^^^ >string : string diff --git a/tests/baselines/reference/subtypingWithCallSignatures.types b/tests/baselines/reference/subtypingWithCallSignatures.types index b9832adcfd6e3..073333bd34ac4 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures.types +++ b/tests/baselines/reference/subtypingWithCallSignatures.types @@ -6,8 +6,8 @@ module CallSignature { > : ^^^^^^^^^^^^^^^^^^^^ declare function foo1(cb: (x: number) => void): typeof cb; ->foo1 : { (cb: (x: number) => void): (x: number) => void; (cb: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo1 : { (cb: (x: number) => void): typeof cb; (cb: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >cb : (x: number) => void > : ^^^^ ^^^^^ >x : number @@ -49,8 +49,8 @@ module CallSignature { > : ^^ declare function foo2(cb: (x: number, y: number) => void): typeof cb; ->foo2 : { (cb: (x: number, y: number) => void): (x: number, y: number) => void; (cb: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo2 : { (cb: (x: number, y: number) => void): typeof cb; (cb: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >cb : (x: number, y: number) => void > : ^^^^ ^^^^^ ^^^^^ >x : number diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index df7d041ba4a2f..4e25624cd6b4a 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -39,8 +39,8 @@ module Errors { > : ^^^^^^ declare function foo2(a2: (x: number) => string[]): typeof a2; ->foo2 : { (a2: (x: number) => string[]): (x: number) => string[]; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo2 : { (a2: (x: number) => string[]): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: number) => string[] > : ^^^^ ^^^^^ >x : number @@ -54,8 +54,8 @@ module Errors { >a2 : any declare function foo7(a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): typeof a2; ->foo7 : { (a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): (x: (arg: Base) => Derived) => (r: Base) => Derived2; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo7 : { (a2: (x: (arg: Base) => Derived) => (r: Base) => Derived2): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 > : ^^^^ ^^^^^ >x : (arg: Base) => Derived @@ -73,8 +73,8 @@ module Errors { >a2 : any declare function foo8(a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; ->foo8 : { (a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo8 : { (a2: (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived > : ^^^^ ^^^^^ ^^^^^ >x : (arg: Base) => Derived @@ -96,8 +96,8 @@ module Errors { >a2 : any declare function foo10(a2: (...x: Base[]) => Base): typeof a2; ->foo10 : { (a2: (...x: Base[]) => Base): (...x: Base[]) => Base; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo10 : { (a2: (...x: Base[]) => Base): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (...x: Base[]) => Base > : ^^^^^^^ ^^^^^ >x : Base[] @@ -111,8 +111,8 @@ module Errors { >a2 : any declare function foo11(a2: (x: { foo: string }, y: { foo: string; bar: string }) => Base): typeof a2; ->foo11 : { (a2: (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): (x: { foo: string; }, y: { foo: string; bar: string; }) => Base; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo11 : { (a2: (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base > : ^^^^ ^^^^^ ^^^^^ >x : { foo: string; } @@ -134,8 +134,8 @@ module Errors { >a2 : any declare function foo12(a2: (x: Array, y: Array) => Array): typeof a2; ->foo12 : { (a2: (x: Array, y: Array) => Array): (x: Array, y: Array) => Array; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo12 : { (a2: (x: Array, y: Array) => Array): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: Array, y: Array) => Array > : ^^^^ ^^^^^ ^^^^^ >x : Base[] @@ -151,8 +151,8 @@ module Errors { >a2 : any declare function foo15(a2: (x: { a: string; b: number }) => number): typeof a2; ->foo15 : { (a2: (x: { a: string; b: number; }) => number): (x: { a: string; b: number; }) => number; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo15 : { (a2: (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: { a: string; b: number; }) => number > : ^^^^ ^^^^^ >x : { a: string; b: number; } @@ -170,8 +170,8 @@ module Errors { >a2 : any declare function foo16(a2: { ->foo16 : { (a2: { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }): { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^ +>foo16 : { (a2: { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : { (x: { (a: number): number; (a?: number): number; }): number[]; (x: { (a: boolean): boolean; (a?: boolean): boolean; }): boolean[]; } > : ^^^^^^ ^^^ ^^^^^^ ^^^ ^^^ @@ -212,8 +212,8 @@ module Errors { >a2 : any declare function foo17(a2: { ->foo17 : { (a2: { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; }): { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; }; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^ ^^^ ^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^ +>foo17 : { (a2: { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; }): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : { (x: { (a: T): T; (a: T): T; }): any[]; (x: { (a: T): T; (a: T): T; }): any[]; } > : ^^^^^^ ^^^ ^^^^^^ ^^^ ^^^ @@ -748,8 +748,8 @@ module WithGenericSignaturesInBaseType { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declare function foo2(a2: (x: T) => T[]): typeof a2; ->foo2 : { (a2: (x: T) => T[]): (x: T) => T[]; (a2: any): any; } -> : ^^^^^^^ ^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo2 : { (a2: (x: T) => T[]): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: T) => T[] > : ^ ^^^^^ ^^^^^ >x : T @@ -783,8 +783,8 @@ module WithGenericSignaturesInBaseType { > : ^^^^^^^^^^^^^^^^^^^^^ declare function foo3(a2: (x: T) => string[]): typeof a2; ->foo3 : { (a2: (x: T) => string[]): (x: T) => string[]; (a2: any): any; } -> : ^^^^^^^ ^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo3 : { (a2: (x: T) => string[]): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : (x: T) => string[] > : ^ ^^^^^ ^^^^^ >x : T diff --git a/tests/baselines/reference/subtypingWithConstructSignatures.types b/tests/baselines/reference/subtypingWithConstructSignatures.types index 80cbb2dd486d0..479558a2c5fe6 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures.types @@ -6,8 +6,8 @@ module ConstructSignature { > : ^^^^^^^^^^^^^^^^^^^^^^^^^ declare function foo1(cb: new (x: number) => void): typeof cb; ->foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo1 : { (cb: new (x: number) => void): typeof cb; (cb: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >cb : new (x: number) => void > : ^^^^^^^^ ^^^^^ >x : number @@ -53,8 +53,8 @@ module ConstructSignature { > : ^^^^^^^^^^^^^^^^^^^^^^^ declare function foo2(cb: new (x: number, y: number) => void): typeof cb; ->foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo2 : { (cb: new (x: number, y: number) => void): typeof cb; (cb: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >cb : new (x: number, y: number) => void > : ^^^^^^^^ ^^^^^ ^^^^^ >x : number diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.types b/tests/baselines/reference/subtypingWithConstructSignatures3.types index 94d657a356410..10fb99fd8ecb7 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -39,8 +39,8 @@ module Errors { > : ^^^^^^ declare function foo2(a2: new (x: number) => string[]): typeof a2; ->foo2 : { (a2: new (x: number) => string[]): new (x: number) => string[]; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo2 : { (a2: new (x: number) => string[]): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: number) => string[] > : ^^^^^^^^ ^^^^^ >x : number @@ -54,8 +54,8 @@ module Errors { >a2 : any declare function foo7(a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): typeof a2; ->foo7 : { (a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo7 : { (a2: new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 > : ^^^^^^^^ ^^^^^ >x : new (arg: Base) => Derived @@ -73,8 +73,8 @@ module Errors { >a2 : any declare function foo8(a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; ->foo8 : { (a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo8 : { (a2: new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived > : ^^^^^^^^ ^^^^^ ^^^^^ >x : new (arg: Base) => Derived @@ -96,8 +96,8 @@ module Errors { >a2 : any declare function foo10(a2: new (...x: Base[]) => Base): typeof a2; ->foo10 : { (a2: new (...x: Base[]) => Base): new (...x: Base[]) => Base; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo10 : { (a2: new (...x: Base[]) => Base): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (...x: Base[]) => Base > : ^^^^^^^^^^^ ^^^^^ >x : Base[] @@ -111,8 +111,8 @@ module Errors { >a2 : any declare function foo11(a2: new (x: { foo: string }, y: { foo: string; bar: string }) => Base): typeof a2; ->foo11 : { (a2: new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo11 : { (a2: new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base > : ^^^^^^^^ ^^^^^ ^^^^^ >x : { foo: string; } @@ -134,8 +134,8 @@ module Errors { >a2 : any declare function foo12(a2: new (x: Array, y: Array) => Array): typeof a2; ->foo12 : { (a2: new (x: Array, y: Array) => Array): new (x: Array, y: Array) => Array; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo12 : { (a2: new (x: Array, y: Array) => Array): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: Array, y: Array) => Array > : ^^^^^^^^ ^^^^^ ^^^^^ >x : Base[] @@ -151,8 +151,8 @@ module Errors { >a2 : any declare function foo15(a2: new (x: { a: string; b: number }) => number): typeof a2; ->foo15 : { (a2: new (x: { a: string; b: number; }) => number): new (x: { a: string; b: number; }) => number; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo15 : { (a2: new (x: { a: string; b: number; }) => number): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: { a: string; b: number; }) => number > : ^^^^^^^^ ^^^^^ >x : { a: string; b: number; } @@ -170,8 +170,8 @@ module Errors { >a2 : any declare function foo16(a2: { ->foo16 : { (a2: { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }): { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^ +>foo16 : { (a2: { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : { new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; } > : ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^ ^^^ @@ -212,8 +212,8 @@ module Errors { >a2 : any declare function foo17(a2: { ->foo17 : { (a2: { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }): { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^ +>foo17 : { (a2: { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : { new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; } > : ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^ ^^^ @@ -668,8 +668,8 @@ module WithGenericSignaturesInBaseType { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declare function foo2(a2: new (x: T) => T[]): typeof a2; ->foo2 : { (a2: new (x: T) => T[]): new (x: T) => T[]; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo2 : { (a2: new (x: T) => T[]): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: T) => T[] > : ^^^^^ ^^^^^ ^^^^^ >x : T @@ -697,8 +697,8 @@ module WithGenericSignaturesInBaseType { > : ^^^^^^^^^^^^^^^^^^^^^^^^^ declare function foo3(a2: new (x: T) => string[]): typeof a2; ->foo3 : { (a2: new (x: T) => string[]): new (x: T) => string[]; (a2: any): any; } -> : ^^^^^^^ ^^^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^ +>foo3 : { (a2: new (x: T) => string[]): typeof a2; (a2: any): any; } +> : ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^ >a2 : new (x: T) => string[] > : ^^^^^ ^^^^^ ^^^^^ >x : T diff --git a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types index 29c0380268fe4..4395d3b309a50 100644 --- a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types +++ b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types @@ -3,7 +3,7 @@ === typeParameterAndArgumentOfSameName1.ts === function f(A: A): A { >f : (A: A) => A -> : ^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ +> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >A : A > : ^ From d7be8bcaf653c45815eaf963076ce196ba8f9a5f Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 4 Apr 2024 10:45:45 -0700 Subject: [PATCH 2/5] Fix missing type parameter spans --- src/compiler/checker.ts | 2 +- .../reference/contextualComputedNonBindablePropertyType.types | 4 ++-- tests/baselines/reference/contextualTypeSelfReferencing.types | 2 +- tests/baselines/reference/genericsManyTypeParameters.types | 2 +- tests/baselines/reference/inferenceAndHKTs.types | 2 +- tests/baselines/reference/mappedTypeRecursiveInference2.types | 2 +- .../noUnusedLocals_typeParameterMergedWithParameter.types | 4 ++-- .../reference/typeParameterAndArgumentOfSameName1.types | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 417f75706a57f..dfaed0e8987f2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8680,7 +8680,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const parameter = sym.valueDeclaration.kind === SyntaxKind.Parameter ? sym.valueDeclaration : findAncestor(sym.valueDeclaration, n => n.kind === SyntaxKind.Parameter || context.enclosingDeclaration === n.parent); if (parameter) { - return { introducesError, node }; + return { introducesError, node: attachSymbolToLeftmostIdentifier(node) as T }; } } if (isSymbolAccessible(sym, context.enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ false).accessibility !== SymbolAccessibility.Accessible) { diff --git a/tests/baselines/reference/contextualComputedNonBindablePropertyType.types b/tests/baselines/reference/contextualComputedNonBindablePropertyType.types index 2c2f652104344..b2bf56d491745 100644 --- a/tests/baselines/reference/contextualComputedNonBindablePropertyType.types +++ b/tests/baselines/reference/contextualComputedNonBindablePropertyType.types @@ -95,9 +95,9 @@ type Mapped = { const propSelector = (propName: propName): propName => propName; >propSelector : (propName: propName) => propName -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >(propName: propName): propName => propName : (propName: propName) => propName -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >propName : propName > : ^^^^^^^^ >propName : propName diff --git a/tests/baselines/reference/contextualTypeSelfReferencing.types b/tests/baselines/reference/contextualTypeSelfReferencing.types index 530113057539a..d98cff6c03dc6 100644 --- a/tests/baselines/reference/contextualTypeSelfReferencing.types +++ b/tests/baselines/reference/contextualTypeSelfReferencing.types @@ -16,7 +16,7 @@ type narrow = def extends string declare const parse: (def: narrow) => def; >parse : (def: narrow) => def -> : ^^^^^^^^^^^ ^^^^^ +> : ^ ^^^^^^^ ^^^^^ >def : narrow > : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/genericsManyTypeParameters.types b/tests/baselines/reference/genericsManyTypeParameters.types index 84867fcbc0d74..afbc172e562ef 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.types +++ b/tests/baselines/reference/genericsManyTypeParameters.types @@ -8,7 +8,7 @@ Symbol count: 25,500 / 25,500 (nearest 500) === genericsManyTypeParameters.ts === function Foo< >Foo : (x1: a1, y1: a21, z1: a31, a1: a41, b1: a51, c1: a61, x2: a119, y2: a22, z2: a32, a2: a42, b2: a52, c2: a62, x3: a219, y3: a23, z3: a33, a3: a43, b3: a53, c3: a63, x4: a319, y4: a24, z4: a34, a4: a44, b4: a54, c4: a64, x5: a419, y5: a25, z5: a35, a5: a45, b5: a55, c5: a65, x6: a519, y6: a26, z6: a36, a6: a46, b6: a56, c6: a66, x7: a619, y7: a27, z7: a37, a7: a47, b7: a57, c7: a67, x8: a71, y8: a28, z8: a38, a8: a48, b8: a58, c8: a68, x9: a81, y9: a29, z9: a39, a9: a49, b9: a59, c9: a69, x10: a91, y12: a210, z10: a310, a10: a410, b10: a510, c10: a610, x11: a111, y13: a211, z11: a311, a11: a411, b11: a511, c11: a611, x12: a112, y14: a212, z12: a312, a12: a412, b12: a512, c12: a612, x13: a113, y15: a213, z13: a313, a13: a413, b13: a513, c13: a613, x14: a114, y16: a214, z14: a314, a14: a414, b14: a514, c14: a614, x15: a115, y17: a215, z15: a315, a15: a415, b15: a515, c15: a615, x16: a116, y18: a216, z16: a316, a16: a416, b16: a516, c16: a616, x17: a117, y19: a217, z17: a317, a17: a417, b17: a517, c17: a617, x18: a118, y10: a218, z18: a318, a18: a418, b18: a518, c18: a618) => (a1 | a21 | a31 | a41 | a51 | a61 | a119 | a22 | a32 | a42 | a52 | a62 | a219 | a23 | a33 | a43 | a53 | a63 | a319 | a24 | a34 | a44 | a54 | a64 | a419 | a25 | a35 | a45 | a55 | a65 | a519 | a26 | a36 | a46 | a56 | a66 | a619 | a27 | a37 | a47 | a57 | a67 | a71 | a28 | a38 | a48 | a58 | a68 | a81 | a29 | a39 | a49 | a59 | a69 | a91 | a210 | a310 | a410 | a510 | a610 | a111 | a211 | a311 | a411 | a511 | a611 | a112 | a212 | a312 | a412 | a512 | a612 | a113 | a213 | a313 | a413 | a513 | a613 | a114 | a214 | a314 | a414 | a514 | a614 | a115 | a215 | a315 | a415 | a515 | a615 | a116 | a216 | a316 | a416 | a516 | a616 | a117 | a217 | a317 | a417 | a517 | a617 | a118 | a218 | a318 | a418 | a518 | a618)[] -> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a1, a21, a31, a41, a51, a61, a119, a22, a32, a42, a52, a62, diff --git a/tests/baselines/reference/inferenceAndHKTs.types b/tests/baselines/reference/inferenceAndHKTs.types index 1159749bae692..dc67d34d219b2 100644 --- a/tests/baselines/reference/inferenceAndHKTs.types +++ b/tests/baselines/reference/inferenceAndHKTs.types @@ -45,7 +45,7 @@ export interface TTypeLambda extends TypeLambda { export declare const map: (F: TypeClass) => (a: Apply, f: (a: A) => B) => Apply; >map : (F: TypeClass) => (a: Apply, f: (a: A) => B) => Apply -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ >F : TypeClass > : ^^^^^^^^^^^^ >a : Apply diff --git a/tests/baselines/reference/mappedTypeRecursiveInference2.types b/tests/baselines/reference/mappedTypeRecursiveInference2.types index f5dafb1b47c49..f05d7696c796d 100644 --- a/tests/baselines/reference/mappedTypeRecursiveInference2.types +++ b/tests/baselines/reference/mappedTypeRecursiveInference2.types @@ -26,7 +26,7 @@ type validateDefinition = def extends MorphTuple declare function type(def: validateDefinition): def >type : (def: validateDefinition) => def -> : ^^^^^^^^^^^ ^^^^^ +> : ^ ^^^^^^^ ^^^^^ >def : validateDefinition > : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types b/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types index 247257ab95249..b16e1e36fdec8 100644 --- a/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types +++ b/tests/baselines/reference/noUnusedLocals_typeParameterMergedWithParameter.types @@ -20,13 +20,13 @@ function useParam(T: number) { function useTypeParam(T: T) {} >useTypeParam : (T: T) => void -> : ^^^^^^^ ^^^^^^^^^ +> : ^ ^^^^^ ^^^^^^^^^ >T : T > : ^ function useBoth(T: T) { >useBoth : (T: T) => T -> : ^^^^^^^ ^^^^^^ +> : ^ ^^^^^ ^^^^^^ >T : T > : ^ diff --git a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types index 4395d3b309a50..29c0380268fe4 100644 --- a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types +++ b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.types @@ -3,7 +3,7 @@ === typeParameterAndArgumentOfSameName1.ts === function f(A: A): A { >f : (A: A) => A -> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ +> : ^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ >A : A > : ^ From 59a9ec98e918cf7d893fa244f2da8d0b592d138b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 4 Apr 2024 10:56:49 -0700 Subject: [PATCH 3/5] Fix parameter finding logic --- src/compiler/checker.ts | 3 +-- .../reference/cyclicGenericTypeInstantiation.types | 8 ++++---- .../cyclicGenericTypeInstantiationInference.types | 8 ++++---- tests/baselines/reference/cyclicTypeInstantiation.types | 8 ++++---- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index dfaed0e8987f2..0395b18ae2490 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8677,8 +8677,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { sym.flags & SymbolFlags.FunctionScopedVariable && sym.valueDeclaration ) { - const parameter = sym.valueDeclaration.kind === SyntaxKind.Parameter ? sym.valueDeclaration : - findAncestor(sym.valueDeclaration, n => n.kind === SyntaxKind.Parameter || context.enclosingDeclaration === n.parent); + const parameter = sym.valueDeclaration && isParameterDeclaration(sym.valueDeclaration); if (parameter) { return { introducesError, node: attachSymbolToLeftmostIdentifier(node) as T }; } diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiation.types b/tests/baselines/reference/cyclicGenericTypeInstantiation.types index 25b41e7b10ddd..191119a1e13d8 100644 --- a/tests/baselines/reference/cyclicGenericTypeInstantiation.types +++ b/tests/baselines/reference/cyclicGenericTypeInstantiation.types @@ -2,8 +2,8 @@ === cyclicGenericTypeInstantiation.ts === function foo() { ->foo : () => { y2: typeof z; } -> : ^^^^^^^^^^^^^^^ ^^^ +>foo : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ var z = foo(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } @@ -33,8 +33,8 @@ function foo() { function bar() { ->bar : () => { y2: typeof z; } -> : ^^^^^^^^^^^^^^^ ^^^ +>bar : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ var z = bar(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } diff --git a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types index ff8ee04fe63af..da10cb7952070 100644 --- a/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types +++ b/tests/baselines/reference/cyclicGenericTypeInstantiationInference.types @@ -2,8 +2,8 @@ === cyclicGenericTypeInstantiationInference.ts === function foo() { ->foo : () => { y2: typeof z; } -> : ^^^^^^^^^^^^^^^ ^^^ +>foo : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ var z = foo(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } @@ -33,8 +33,8 @@ function foo() { function bar() { ->bar : () => { y2: typeof z; } -> : ^^^^^^^^^^^^^^^ ^^^ +>bar : () => { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ var z = bar(); >z : { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: { y2: any; }; }; }; }; }; }; }; }; }; }; } diff --git a/tests/baselines/reference/cyclicTypeInstantiation.types b/tests/baselines/reference/cyclicTypeInstantiation.types index 63f7724a072ad..c4072505818fb 100644 --- a/tests/baselines/reference/cyclicTypeInstantiation.types +++ b/tests/baselines/reference/cyclicTypeInstantiation.types @@ -2,8 +2,8 @@ === cyclicTypeInstantiation.ts === function foo() { ->foo : () => { a: T; b: typeof x; } -> : ^ ^^^^^^^^^^^^ ^^^^^ ^^^ +>foo : () => { a: T; b: any; } +> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^^ var x: { >x : { a: T; b: any; } @@ -26,8 +26,8 @@ function foo() { } function bar() { ->bar : () => { a: T; b: typeof x; } -> : ^ ^^^^^^^^^^^^ ^^^^^ ^^^ +>bar : () => { a: T; b: any; } +> : ^ ^^^^^^^^^^^^ ^^^^^^^^^^^ var x: { >x : { a: T; b: any; } From 67dc3602d17b66d2d9ba9f5a94f99a0f90c4f90c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 4 Apr 2024 11:09:09 -0700 Subject: [PATCH 4/5] Include correction to getMeaningOfEntityNameReference here, since it depends on this and otherwise has no baseline diffs --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0395b18ae2490..e527aecd0700c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6329,7 +6329,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if ( entityName.parent.kind === SyntaxKind.TypeQuery || entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments && !isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === SyntaxKind.ComputedPropertyName + entityName.parent.kind === SyntaxKind.ComputedPropertyName || + entityName.parent.kind === SyntaxKind.TypePredicate && (entityName.parent as TypePredicateNode).parameterName === entityName ) { // Typeof value meaning = SymbolFlags.Value | SymbolFlags.ExportValue; From 350ad479904bcfd43d5b127b9c3c1eb536184eef Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 4 Apr 2024 11:16:43 -0700 Subject: [PATCH 5/5] Simplify --- src/compiler/checker.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e527aecd0700c..d411ba69c76d4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8678,8 +8678,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { sym.flags & SymbolFlags.FunctionScopedVariable && sym.valueDeclaration ) { - const parameter = sym.valueDeclaration && isParameterDeclaration(sym.valueDeclaration); - if (parameter) { + if (isParameterDeclaration(sym.valueDeclaration)) { return { introducesError, node: attachSymbolToLeftmostIdentifier(node) as T }; } }