-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testcase with secondary alias that should be picked up, add code …
…to ensure locally accessible type aliases are materialized at printback time
- Loading branch information
Showing
31 changed files
with
276 additions
and
65 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
59 changes: 59 additions & 0 deletions
59
tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.js
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,59 @@ | ||
//// [tests/cases/compiler/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.ts] //// | ||
|
||
//// [init.ts] | ||
export interface A { | ||
a: true; | ||
} | ||
|
||
export interface B { | ||
b: true; | ||
} | ||
|
||
export function f(thing?: A | B): A | B { return null as any; }; | ||
//// [utils.ts] | ||
import {A, B} from "./init"; | ||
|
||
export type Either = A | B; | ||
//// [usage.ts] | ||
import {Either} from "./utils"; | ||
import {f} from "./init"; | ||
|
||
export function doThing() { | ||
return f(); | ||
} | ||
|
||
//// [init.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.f = void 0; | ||
function f(thing) { return null; } | ||
exports.f = f; | ||
; | ||
//// [utils.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [usage.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.doThing = void 0; | ||
var init_1 = require("./init"); | ||
function doThing() { | ||
return init_1.f(); | ||
} | ||
exports.doThing = doThing; | ||
|
||
|
||
//// [init.d.ts] | ||
export interface A { | ||
a: true; | ||
} | ||
export interface B { | ||
b: true; | ||
} | ||
export declare function f(thing?: A | B): A | B; | ||
//// [utils.d.ts] | ||
import { A, B } from "./init"; | ||
export declare type Either = A | B; | ||
//// [usage.d.ts] | ||
import { Either } from "./utils"; | ||
export declare function doThing(): Either; |
46 changes: 46 additions & 0 deletions
46
tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.symbols
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,46 @@ | ||
=== tests/cases/compiler/init.ts === | ||
export interface A { | ||
>A : Symbol(A, Decl(init.ts, 0, 0)) | ||
|
||
a: true; | ||
>a : Symbol(A.a, Decl(init.ts, 0, 20)) | ||
} | ||
|
||
export interface B { | ||
>B : Symbol(B, Decl(init.ts, 2, 1)) | ||
|
||
b: true; | ||
>b : Symbol(B.b, Decl(init.ts, 4, 20)) | ||
} | ||
|
||
export function f(thing?: A | B): A | B { return null as any; }; | ||
>f : Symbol(f, Decl(init.ts, 6, 1)) | ||
>thing : Symbol(thing, Decl(init.ts, 8, 18)) | ||
>A : Symbol(A, Decl(init.ts, 0, 0)) | ||
>B : Symbol(B, Decl(init.ts, 2, 1)) | ||
>A : Symbol(A, Decl(init.ts, 0, 0)) | ||
>B : Symbol(B, Decl(init.ts, 2, 1)) | ||
|
||
=== tests/cases/compiler/utils.ts === | ||
import {A, B} from "./init"; | ||
>A : Symbol(A, Decl(utils.ts, 0, 8)) | ||
>B : Symbol(B, Decl(utils.ts, 0, 10)) | ||
|
||
export type Either = A | B; | ||
>Either : Symbol(Either, Decl(utils.ts, 0, 28)) | ||
>A : Symbol(A, Decl(utils.ts, 0, 8)) | ||
>B : Symbol(B, Decl(utils.ts, 0, 10)) | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
import {Either} from "./utils"; | ||
>Either : Symbol(Either, Decl(usage.ts, 0, 8)) | ||
|
||
import {f} from "./init"; | ||
>f : Symbol(f, Decl(usage.ts, 1, 8)) | ||
|
||
export function doThing() { | ||
>doThing : Symbol(doThing, Decl(usage.ts, 1, 25)) | ||
|
||
return f(); | ||
>f : Symbol(f, Decl(usage.ts, 1, 8)) | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/baselines/reference/aliasDeclaredAfterFirstUsageUsedByDeclarationEmit.types
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,41 @@ | ||
=== tests/cases/compiler/init.ts === | ||
export interface A { | ||
a: true; | ||
>a : true | ||
>true : true | ||
} | ||
|
||
export interface B { | ||
b: true; | ||
>b : true | ||
>true : true | ||
} | ||
|
||
export function f(thing?: A | B): A | B { return null as any; }; | ||
>f : (thing?: A | B) => A | B | ||
>thing : import("tests/cases/compiler/utils").Either | ||
>null as any : any | ||
>null : null | ||
|
||
=== tests/cases/compiler/utils.ts === | ||
import {A, B} from "./init"; | ||
>A : any | ||
>B : any | ||
|
||
export type Either = A | B; | ||
>Either : Either | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
import {Either} from "./utils"; | ||
>Either : any | ||
|
||
import {f} from "./init"; | ||
>f : (thing?: Either) => Either | ||
|
||
export function doThing() { | ||
>doThing : () => Either | ||
|
||
return f(); | ||
>f() : Either | ||
>f : (thing?: Either) => Either | ||
} |
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
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
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
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
Oops, something went wrong.