-
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.
Merge pull request #940 from Microsoft/asynchrounousAliasWriteCrash
Fix the crash in declaration file emit when alias is used before its declaration
- Loading branch information
Showing
7 changed files
with
124 additions
and
6 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
29 changes: 29 additions & 0 deletions
29
tests/baselines/reference/declFileAliasUseBeforeDeclaration.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,29 @@ | ||
//// [tests/cases/compiler/declFileAliasUseBeforeDeclaration.ts] //// | ||
|
||
//// [declFileAliasUseBeforeDeclaration_foo.ts] | ||
|
||
export class Foo { } | ||
|
||
//// [declFileAliasUseBeforeDeclaration_test.ts] | ||
export function bar(a: foo.Foo) { } | ||
import foo = require("declFileAliasUseBeforeDeclaration_foo"); | ||
|
||
//// [declFileAliasUseBeforeDeclaration_foo.js] | ||
var Foo = (function () { | ||
function Foo() { | ||
} | ||
return Foo; | ||
})(); | ||
exports.Foo = Foo; | ||
//// [declFileAliasUseBeforeDeclaration_test.js] | ||
function bar(a) { | ||
} | ||
exports.bar = bar; | ||
|
||
|
||
//// [declFileAliasUseBeforeDeclaration_foo.d.ts] | ||
export declare class Foo { | ||
} | ||
//// [declFileAliasUseBeforeDeclaration_test.d.ts] | ||
export declare function bar(a: foo.Foo): void; | ||
import foo = require("declFileAliasUseBeforeDeclaration_foo"); |
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/declFileAliasUseBeforeDeclaration.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,15 @@ | ||
=== tests/cases/compiler/declFileAliasUseBeforeDeclaration_test.ts === | ||
export function bar(a: foo.Foo) { } | ||
>bar : (a: foo.Foo) => void | ||
>a : foo.Foo | ||
>foo : unknown | ||
>Foo : foo.Foo | ||
|
||
import foo = require("declFileAliasUseBeforeDeclaration_foo"); | ||
>foo : typeof foo | ||
|
||
=== tests/cases/compiler/declFileAliasUseBeforeDeclaration_foo.ts === | ||
|
||
export class Foo { } | ||
>Foo : Foo | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/declFileAliasUseBeforeDeclaration2.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,25 @@ | ||
//// [declFileAliasUseBeforeDeclaration2.ts] | ||
|
||
declare module "test" { | ||
module A { | ||
class C { | ||
} | ||
} | ||
class B extends E { | ||
} | ||
import E = A.C; | ||
} | ||
|
||
//// [declFileAliasUseBeforeDeclaration2.js] | ||
|
||
|
||
//// [declFileAliasUseBeforeDeclaration2.d.ts] | ||
declare module "test" { | ||
module A { | ||
class C { | ||
} | ||
} | ||
class B extends E { | ||
} | ||
import E = A.C; | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/declFileAliasUseBeforeDeclaration2.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,19 @@ | ||
=== tests/cases/compiler/declFileAliasUseBeforeDeclaration2.ts === | ||
|
||
declare module "test" { | ||
module A { | ||
>A : typeof A | ||
|
||
class C { | ||
>C : C | ||
} | ||
} | ||
class B extends E { | ||
>B : B | ||
>E : E | ||
} | ||
import E = A.C; | ||
>E : typeof E | ||
>A : typeof A | ||
>C : E | ||
} |
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 @@ | ||
//@module: commonjs | ||
//@declaration: true | ||
|
||
// @Filename: declFileAliasUseBeforeDeclaration_foo.ts | ||
export class Foo { } | ||
|
||
// @Filename: declFileAliasUseBeforeDeclaration_test.ts | ||
export function bar(a: foo.Foo) { } | ||
import foo = require("declFileAliasUseBeforeDeclaration_foo"); |
12 changes: 12 additions & 0 deletions
12
tests/cases/compiler/declFileAliasUseBeforeDeclaration2.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,12 @@ | ||
//@module: commonjs | ||
//@declaration: true | ||
|
||
declare module "test" { | ||
module A { | ||
class C { | ||
} | ||
} | ||
class B extends E { | ||
} | ||
import E = A.C; | ||
} |