Skip to content

Commit e03a45a

Browse files
committed
Fix fallback to classic resolution
1 parent 02df499 commit e03a45a

File tree

54 files changed

+86
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+86
-80
lines changed

src/compiler/program.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace ts {
100100

101101
let moduleResolution = compilerOptions.moduleResolution;
102102
if (moduleResolution === undefined) {
103-
moduleResolution = compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
103+
moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
104104
if (traceEnabled) {
105105
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
106106
}

src/harness/harness.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,8 @@ namespace Harness {
896896
{ name: "fileName", type: "string" },
897897
{ name: "libFiles", type: "string" },
898898
{ name: "noErrorTruncation", type: "boolean" },
899-
{ name: "suppressOutputPathCheck", type: "boolean" }
899+
{ name: "suppressOutputPathCheck", type: "boolean" },
900+
{ name: "moduleResolution", type: "string"}
900901
];
901902

902903
let optionsIndex: ts.Map<ts.CommandLineOption>;

tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export module m {
66
}
77

88
//// [importAliasAnExternalModuleInsideAnInternalModule_file1.ts]
9-
import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
9+
import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0');
1010
module m_private {
1111
//import r2 = require('m'); // would be error
1212
export import C = r; // no error
@@ -23,7 +23,7 @@ var m;
2323
})(m = exports.m || (exports.m = {}));
2424
//// [importAliasAnExternalModuleInsideAnInternalModule_file1.js]
2525
"use strict";
26-
var r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
26+
var r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0');
2727
var m_private;
2828
(function (m_private) {
2929
//import r2 = require('m'); // would be error

tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.symbols

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts ===
2-
import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
2+
import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0');
33
>r : Symbol(r, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 0, 0))
44

55
module m_private {
6-
>m_private : Symbol(m_private, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 0, 78))
6+
>m_private : Symbol(m_private, Decl(importAliasAnExternalModuleInsideAnInternalModule_file1.ts, 0, 80))
77

88
//import r2 = require('m'); // would be error
99
export import C = r; // no error

tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts ===
2-
import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
2+
import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0');
33
>r : typeof r
44

55
module m_private {

tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export module m {
44
}
55

66
// @Filename: importAliasAnExternalModuleInsideAnInternalModule_file1.ts
7-
import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
7+
import r = require('./importAliasAnExternalModuleInsideAnInternalModule_file0');
88
module m_private {
99
//import r2 = require('m'); // would be error
1010
export import C = r; // no error

tests/cases/conformance/externalModules/relativePathToDeclarationFile.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ModuleResolution: classic
12
// @Filename: test/foo.d.ts
23
export declare module M2 {
34
export var x: boolean;

tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
////}
1818

1919
//@Filename: findAllRefsOnDefinition.ts
20-
////import Second = require("findAllRefsOnDefinition-import");
20+
////import Second = require("./findAllRefsOnDefinition-import");
2121
////
2222
////var second = new Second.Test()
2323
////second.start();

tests/cases/fourslash/cloduleAsBaseClass2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
////export = A;
1616

1717
// @Filename: cloduleAsBaseClass2_1.ts
18-
////import B = require('cloduleAsBaseClass2_0');
18+
////import B = require('./cloduleAsBaseClass2_0');
1919
////class D extends B {
2020
//// constructor() {
2121
//// super(1);

tests/cases/fourslash/commentsExternalModules.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
// @Filename: commentsExternalModules_file1.ts
2929
/////**This is on import declaration*/
30-
////import ex/*9*/tMod = require("commentsExternalModules_file0");
30+
////import ex/*9*/tMod = require("./commentsExternalModules_file0");
3131
/////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/);
3232
////var new/*14*/Var = new extMod.m1.m2./*15*/c();
3333

@@ -69,10 +69,10 @@ verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i");
6969

7070
goTo.file("commentsExternalModules_file1.ts");
7171
goTo.marker('9');
72-
verify.quickInfoIs('import extMod = require("commentsExternalModules_file0")', "This is on import declaration");
72+
verify.quickInfoIs('import extMod = require("./commentsExternalModules_file0")', "This is on import declaration");
7373

7474
goTo.marker('10');
75-
verify.completionListContains("extMod", 'import extMod = require("commentsExternalModules_file0")', "This is on import declaration");
75+
verify.completionListContains("extMod", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration");
7676

7777
goTo.marker('11');
7878
verify.memberListContains("m1", "namespace extMod.m1");

tests/cases/fourslash/commentsImportDeclaration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
// @Filename: commentsImportDeclaration_file1.ts
2121
///////<reference path='commentsImportDeclaration_file0.ts'/>
2222
/////** Import declaration*/
23-
////import /*3*/extMod = require("commentsImportDeclaration_file0/*4*/");
23+
////import /*3*/extMod = require("./commentsImportDeclaration_file0/*4*/");
2424
////extMod./*6*/m1./*7*/fooEx/*8q*/port(/*8*/);
2525
////var new/*9*/Var = new extMod.m1.m2./*10*/c();
2626

2727
goTo.marker('2');
2828
verify.quickInfoIs("namespace m1", "NamespaceComment");
2929

3030
goTo.marker('3');
31-
verify.quickInfoIs('import extMod = require("commentsImportDeclaration_file0")', "Import declaration");
31+
verify.quickInfoIs('import extMod = require("./commentsImportDeclaration_file0")', "Import declaration");
3232

3333
goTo.marker('6');
3434
verify.memberListContains("m1", "namespace extMod.m1");

tests/cases/fourslash/completionListForTransitivelyExportedMembers01.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525
// @Filename: C.ts
2626
////export var cVar = "see!";
27-
////export * from "A";
28-
////export * from "B"
27+
////export * from "./A";
28+
////export * from "./B"
2929

3030
// @Filename: D.ts
31-
////import * as c from "C";
31+
////import * as c from "./C";
3232
////var x = c./**/
3333

3434
goTo.marker();

tests/cases/fourslash/completionListForTransitivelyExportedMembers02.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
// @Filename: C.ts
2727
////export var cVar = "see!";
28-
////export * from "A";
29-
////export * from "B"
28+
////export * from "./A";
29+
////export * from "./B"
3030

3131
// @Filename: D.ts
32-
////import * as c from "C";
32+
////import * as c from "./C";
3333
////var x = c.Inner./**/
3434

3535
goTo.marker();

tests/cases/fourslash/completionListForTransitivelyExportedMembers03.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
// @Filename: C.ts
2727
////export var cVar = "see!";
28-
////export * from "A";
29-
////export * from "B"
28+
////export * from "./A";
29+
////export * from "./B"
3030

3131
// @Filename: D.ts
32-
////import * as c from "C";
32+
////import * as c from "./C";
3333
////var x: c./**/
3434

3535
goTo.marker();

tests/cases/fourslash/completionListForTransitivelyExportedMembers04.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///<reference path="fourslash.ts" />
2-
2+
// @ModuleResolution: classic
33

44
// @Filename: A.ts
55
////export interface I1 { one: number }

tests/cases/fourslash/completionListInExportClause01.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
////export function baz() { return 10; }
77

88
// @Filename: m2.ts
9-
////export {/*1*/, /*2*/ from "m1"
10-
////export {/*3*/} from "m1"
11-
////export {foo,/*4*/ from "m1"
12-
////export {bar as /*5*/, /*6*/ from "m1"
13-
////export {foo, bar, baz as b,/*7*/} from "m1"
9+
////export {/*1*/, /*2*/ from "./m1"
10+
////export {/*3*/} from "./m1"
11+
////export {foo,/*4*/ from "./m1"
12+
////export {bar as /*5*/, /*6*/ from "./m1"
13+
////export {foo, bar, baz as b,/*7*/} from "./m1"
1414

1515
function verifyCompletionAtMarker(marker: string, showBuilder: boolean, ...completions: string[]) {
1616
goTo.marker(marker);

tests/cases/fourslash/completionListInImportClause01.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path='fourslash.ts'/>
2+
// @ModuleResolution: classic
23

34
// @Filename: m1.ts
45
////export var foo: number = 1;

tests/cases/fourslash/definition.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path='fourslash.ts'/>
22

33
// @Filename: b.ts
4-
////import n = require('a/*1*/');
4+
////import n = require('./a/*1*/');
55
////var x = new n.Foo();
66

77
// @Filename: a.ts

tests/cases/fourslash/exportEqualCallableInterface.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// @Filename: exportEqualCallableInterface_file1.ts
1111
///////<reference path='exportEqualCallableInterface_file0.ts'/>
12-
////import test = require('exportEqualCallableInterface_file0');
12+
////import test = require('./exportEqualCallableInterface_file0');
1313
////var t2: test;
1414
////t2./**/
1515

tests/cases/fourslash/exportEqualTypes.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
// @Filename: exportEqualTypes_file1.ts
1111
///////<reference path='exportEqualTypes_file0.ts'/>
12-
////import test = require('exportEqualTypes_file0');
12+
////import test = require('./exportEqualTypes_file0');
1313
////var t: /*1*/test; // var 't' should be of type 'test'
1414
////var /*2*/r1 = t(); // Should return a Date
1515
////var /*3*/r2 = t./*4*/foo; // t should have 'foo' in dropdown list and be of type 'string'
1616

1717
goTo.marker('1');
18-
verify.quickInfoIs("import test = require('exportEqualTypes_file0')");
18+
verify.quickInfoIs("import test = require('./exportEqualTypes_file0')");
1919
goTo.marker('2');
2020
verify.quickInfoIs('var r1: Date');
2121
goTo.marker('3');

tests/cases/fourslash/externalModuleIntellisense.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
// @Filename: externalModuleIntellisense_file1.ts
1616
///////<reference path='externalModuleIntellisense_file0.ts'/>
17-
////import express = require('externalModuleIntellisense_file0');
17+
////import express = require('./externalModuleIntellisense_file0');
1818
////var x = express();/*1*/
1919

2020
goTo.marker('1');

tests/cases/fourslash/externalModuleWithExportAssignment.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
////export = m2;
1919

2020
// @Filename: externalModuleWithExportAssignment_file1.ts
21-
////import /*1*/a1 = require("externalModuleWithExportAssignment_file0");
21+
////import /*1*/a1 = require("./externalModuleWithExportAssignment_file0");
2222
////export var /*2*/a = a1;
2323
////a./*3*/test1(/*4*/null, null, null);
2424
////var /*6*/r1 = a.test2(/*5*/);
@@ -30,7 +30,7 @@
3030

3131
goTo.file("externalModuleWithExportAssignment_file1.ts");
3232
goTo.marker('1');
33-
verify.quickInfoIs('import a1 = require("externalModuleWithExportAssignment_file0")');
33+
verify.quickInfoIs('import a1 = require("./externalModuleWithExportAssignment_file0")');
3434

3535
goTo.marker('2');
3636
verify.quickInfoIs("var a: {\n (): a1.connectExport;\n test1: a1.connectModule;\n test2(): a1.connectModule;\n}", undefined);

tests/cases/fourslash/findAllRefsOnDefinition.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
////}
1818

1919
//@Filename: findAllRefsOnDefinition.ts
20-
////import Second = require("findAllRefsOnDefinition-import");
20+
////import Second = require("./findAllRefsOnDefinition-import");
2121
////
2222
////var second = new Second.Test()
2323
////second.start();

tests/cases/fourslash/findAllRefsOnDefinition2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
////}
1010

1111
//@Filename: findAllRefsOnDefinition2.ts
12-
////import Second = require("findAllRefsOnDefinition2-import");
12+
////import Second = require("./findAllRefsOnDefinition2-import");
1313
////
1414
////var start: Second.Test.start;
1515
////var stop: Second.Test.stop;

tests/cases/fourslash/findAllRefsOnImportAliases.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
////}
66

77
//@Filename: b.ts
8-
////import { /*2*/Class } from "a";
8+
////import { /*2*/Class } from "./a";
99
////
1010
////var c = new /*3*/Class();
1111

1212
//@Filename: c.ts
13-
////export { /*4*/Class } from "a";
13+
////export { /*4*/Class } from "./a";
1414

1515
goTo.file("a.ts");
1616
goTo.marker("1");

tests/cases/fourslash/findAllRefsOnImportAliases2.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
////}
66

77
//@Filename: b.ts
8-
////import { /*2*/Class as /*3*/C2} from "a";
8+
////import { /*2*/Class as /*3*/C2} from "./a";
99
////
1010
////var c = new C2();
1111

1212
//@Filename: c.ts
13-
////export { /*4*/Class as /*5*/C3 } from "a";
13+
////export { /*4*/Class as /*5*/C3 } from "./a";
1414

1515
goTo.file("a.ts");
1616
goTo.marker("1");

tests/cases/fourslash/getJavaScriptCompletions15.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
//// export var V = "123"
1212

1313
// @Filename: main.js
14-
//// import ref1 = require("refFile1");
15-
//// var ref2 = require("refFile2");
14+
//// import ref1 = require("./refFile1");
15+
//// var ref2 = require("./refFile2");
1616
//// ref1.V./*1*/;
1717
//// ref2.V./*2*/;
18-
//// var v = { x: require("refFile3") };
18+
//// var v = { x: require("./refFile3") };
1919
//// v.x./*3*/;
2020
//// v.x.V./*4*/;
2121

tests/cases/fourslash/getPreProcessedFile.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path="fourslash.ts" />
2+
// @ModuleResolution: classic
23

34
// @Filename: refFile1.ts
45
//// class D { }

tests/cases/fourslash/goToDefinitionExternalModuleName.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path='fourslash.ts'/>
22

33
// @Filename: b.ts
4-
////import n = require('a/*1*/');
4+
////import n = require('./a/*1*/');
55
////var x = new n.Foo();
66

77
// @Filename: a.ts

tests/cases/fourslash/goToDefinitionExternalModuleName2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path='fourslash.ts'/>
22

33
// @Filename: b.ts
4-
////import n = require('a/*1*/');
4+
////import n = require('./a/*1*/');
55
////var x = new n.Foo();
66

77
// @Filename: a.ts

tests/cases/fourslash/goToDefinitionImportedNames.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path='fourslash.ts' />
22

33
// @Filename: b.ts
4-
////export {/*classAliasDefinition*/Class} from "a";
4+
////export {/*classAliasDefinition*/Class} from "./a";
55

66

77
// @Filename: a.ts

tests/cases/fourslash/goToDefinitionImportedNames2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path='fourslash.ts' />
22

33
// @Filename: b.ts
4-
////import {/*classAliasDefinition*/Class} from "a";
4+
////import {/*classAliasDefinition*/Class} from "./a";
55

66

77
// @Filename: a.ts

tests/cases/fourslash/goToDefinitionImportedNames3.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/// <reference path='fourslash.ts' />
22

33
// @Filename: e.ts
4-
//// import {M, /*classAliasDefinition*/C, I} from "d";
4+
//// import {M, /*classAliasDefinition*/C, I} from "./d";
55
//// var c = new /*classReference*/C();
66

77

88
// @Filename: d.ts
9-
////export * from "c";
9+
////export * from "./c";
1010

1111

1212
// @Filename: c.ts
13-
////export {Module as M, Class as C, Interface as I} from "b";
13+
////export {Module as M, Class as C, Interface as I} from "./b";
1414

1515

1616
// @Filename: b.ts
17-
////export * from "a";
17+
////export * from "./a";
1818

1919

2020
// @Filename: a.ts

0 commit comments

Comments
 (0)