Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(scope-manager): correctly reference generic parameters when decor…
- Loading branch information
1 parent
957523c
commit 7695ef3
Showing
4 changed files
with
227 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/scope-manager/tests/fixtures/class/emit-metadata/method-return-generic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//// @emitDecoratorMetadata = true | ||
|
||
import { TestGeneric, Test } from 'fake-module'; | ||
|
||
declare function deco(..._param: any): any; | ||
export class TestClass { | ||
@deco | ||
public test(): TestGeneric<Test> {} | ||
} |
191 changes: 191 additions & 0 deletions
191
packages/scope-manager/tests/fixtures/class/emit-metadata/method-return-generic.ts.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`class emit-metadata method-return-generic 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
ImplicitGlobalConstTypeVariable, | ||
Variable$2 { | ||
defs: Array [ | ||
ImportBindingDefinition$1 { | ||
name: Identifier<"TestGeneric">, | ||
node: ImportSpecifier$1, | ||
}, | ||
], | ||
name: "TestGeneric", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"TestGeneric">, | ||
isRead: true, | ||
isTypeReference: true, | ||
isValueReference: true, | ||
isWrite: false, | ||
resolved: Variable$2, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$3 { | ||
defs: Array [ | ||
ImportBindingDefinition$2 { | ||
name: Identifier<"Test">, | ||
node: ImportSpecifier$2, | ||
}, | ||
], | ||
name: "Test", | ||
references: Array [ | ||
Reference$2 { | ||
identifier: Identifier<"Test">, | ||
isRead: true, | ||
isTypeReference: true, | ||
isValueReference: false, | ||
isWrite: false, | ||
resolved: Variable$3, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
FunctionNameDefinition$3 { | ||
name: Identifier<"deco">, | ||
node: TSDeclareFunction$3, | ||
}, | ||
], | ||
name: "deco", | ||
references: Array [ | ||
Reference$3 { | ||
identifier: Identifier<"deco">, | ||
isRead: true, | ||
isTypeReference: false, | ||
isValueReference: true, | ||
isWrite: false, | ||
resolved: Variable$4, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$5 { | ||
defs: Array [], | ||
name: "arguments", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$6 { | ||
defs: Array [ | ||
ParameterDefinition$4 { | ||
name: Identifier<"_param">, | ||
node: TSDeclareFunction$3, | ||
}, | ||
], | ||
name: "_param", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$7 { | ||
defs: Array [ | ||
ClassNameDefinition$5 { | ||
name: Identifier<"TestClass">, | ||
node: ClassDeclaration$4, | ||
}, | ||
], | ||
name: "TestClass", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$8 { | ||
defs: Array [ | ||
ClassNameDefinition$6 { | ||
name: Identifier<"TestClass">, | ||
node: ClassDeclaration$4, | ||
}, | ||
], | ||
name: "TestClass", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$9 { | ||
defs: Array [], | ||
name: "arguments", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$5, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"const" => ImplicitGlobalConstTypeVariable, | ||
"TestGeneric" => Variable$2, | ||
"Test" => Variable$3, | ||
"deco" => Variable$4, | ||
"TestClass" => Variable$7, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
ImplicitGlobalConstTypeVariable, | ||
Variable$2, | ||
Variable$3, | ||
Variable$4, | ||
Variable$7, | ||
], | ||
}, | ||
FunctionScope$2 { | ||
block: TSDeclareFunction$3, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"arguments" => Variable$5, | ||
"_param" => Variable$6, | ||
}, | ||
type: "function", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$5, | ||
Variable$6, | ||
], | ||
}, | ||
ClassScope$3 { | ||
block: ClassDeclaration$4, | ||
isStrict: true, | ||
references: Array [ | ||
Reference$3, | ||
], | ||
set: Map { | ||
"TestClass" => Variable$8, | ||
}, | ||
type: "class", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$8, | ||
], | ||
}, | ||
FunctionScope$4 { | ||
block: FunctionExpression$6, | ||
isStrict: true, | ||
references: Array [ | ||
Reference$1, | ||
Reference$2, | ||
], | ||
set: Map { | ||
"arguments" => Variable$9, | ||
}, | ||
type: "function", | ||
upper: ClassScope$3, | ||
variables: Array [ | ||
Variable$9, | ||
], | ||
}, | ||
], | ||
} | ||
`; |