Skip to content

Commit 3fd9eb5

Browse files
committed
Merge branch 'master' into compute-common-source-dir
2 parents 39ebe81 + 13bc120 commit 3fd9eb5

22 files changed

Lines changed: 1189 additions & 1223 deletions

src/compiler/checker.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3829,7 +3829,13 @@ namespace ts {
38293829
let minArgumentCount = -1;
38303830
for (let i = 0, n = declaration.parameters.length; i < n; i++) {
38313831
const param = declaration.parameters[i];
3832-
parameters.push(param.symbol);
3832+
let paramSymbol = param.symbol;
3833+
// Include parameter symbol instead of property symbol in the signature
3834+
if (paramSymbol && !!(paramSymbol.flags & SymbolFlags.Property) && !isBindingPattern(param.name)) {
3835+
const resolvedSymbol = resolveName(param, paramSymbol.name, SymbolFlags.Value, undefined, undefined);
3836+
paramSymbol = resolvedSymbol;
3837+
}
3838+
parameters.push(paramSymbol);
38333839
if (param.type && param.type.kind === SyntaxKind.StringLiteral) {
38343840
hasStringLiterals = true;
38353841
}
@@ -11360,12 +11366,14 @@ namespace ts {
1136011366
const errorNode: Node = (<FunctionLikeDeclaration>subsequentNode).name || subsequentNode;
1136111367
// TODO(jfreeman): These are methods, so handle computed name case
1136211368
if (node.name && (<FunctionLikeDeclaration>subsequentNode).name && (<Identifier>node.name).text === (<Identifier>(<FunctionLikeDeclaration>subsequentNode).name).text) {
11363-
Debug.assert(node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature);
11369+
const reportError =
11370+
(node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) &&
11371+
(node.flags & NodeFlags.Static) !== (subsequentNode.flags & NodeFlags.Static);
1136411372
// we can get here in two cases
1136511373
// 1. mixed static and instance class members
1136611374
// 2. something with the same name was defined before the set of overloads that prevents them from merging
1136711375
// here we'll report error only for the first case since for second we should already report error in binder
11368-
if ((node.flags & NodeFlags.Static) !== (subsequentNode.flags & NodeFlags.Static)) {
11376+
if (reportError) {
1136911377
const diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
1137011378
error(errorNode, diagnostic);
1137111379
}

src/compiler/program.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -800,12 +800,12 @@ namespace ts {
800800
}
801801

802802
// Get source file from normalized fileName
803-
function findSourceFile(fileName: string, normalizedAbsolutePath: Path, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile {
804-
if (filesByName.contains(normalizedAbsolutePath)) {
805-
const file = filesByName.get(normalizedAbsolutePath);
803+
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile {
804+
if (filesByName.contains(path)) {
805+
const file = filesByName.get(path);
806806
// try to check if we've already seen this file but with a different casing in path
807807
// NOTE: this only makes sense for case-insensitive file systems
808-
if (file && options.forceConsistentCasingInFileNames && getNormalizedAbsolutePath(file.fileName, currentDirectory) !== normalizedAbsolutePath) {
808+
if (file && options.forceConsistentCasingInFileNames && getNormalizedAbsolutePath(file.fileName, currentDirectory) !== getNormalizedAbsolutePath(fileName, currentDirectory)) {
809809
reportFileNamesDifferOnlyInCasingError(fileName, file.fileName, refFile, refPos, refEnd);
810810
}
811811

@@ -823,18 +823,18 @@ namespace ts {
823823
}
824824
});
825825

826-
filesByName.set(normalizedAbsolutePath, file);
826+
filesByName.set(path, file);
827827
if (file) {
828-
file.path = normalizedAbsolutePath;
828+
file.path = path;
829829

830830
if (host.useCaseSensitiveFileNames()) {
831831
// for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
832-
const existingFile = filesByNameIgnoreCase.get(normalizedAbsolutePath);
832+
const existingFile = filesByNameIgnoreCase.get(path);
833833
if (existingFile) {
834834
reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd);
835835
}
836836
else {
837-
filesByNameIgnoreCase.set(normalizedAbsolutePath, file);
837+
filesByNameIgnoreCase.set(path, file);
838838
}
839839
}
840840

src/compiler/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,17 +2179,17 @@ namespace ts {
21792179
/* @internal */
21802180
export interface CommandLineOptionBase {
21812181
name: string;
2182-
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
2183-
isFilePath?: boolean; // True if option value is a path or fileName
2184-
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
2185-
description?: DiagnosticMessage; // The message describing what the command line switch does
2186-
paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter
2182+
type: "string" | "number" | "boolean" | Map<number>; // a value of a primitive type, or an object literal mapping named values to actual values
2183+
isFilePath?: boolean; // True if option value is a path or fileName
2184+
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
2185+
description?: DiagnosticMessage; // The message describing what the command line switch does
2186+
paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter
21872187
experimental?: boolean;
21882188
}
21892189

21902190
/* @internal */
21912191
export interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase {
2192-
type: string; // "string" | "number" | "boolean"
2192+
type: "string" | "number" | "boolean";
21932193
}
21942194

21952195
/* @internal */

src/harness/compilerRunner.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ class CompilerBaselineRunner extends RunnerBase {
5151
let justName: string;
5252

5353
let lastUnit: Harness.TestCaseParser.TestUnitData;
54-
let tcSettings: Harness.TestCaseParser.CompilerSettings;
54+
let harnessSettings: Harness.TestCaseParser.CompilerSettings;
5555

5656
let result: Harness.Compiler.CompilerResult;
57-
let program: ts.Program;
5857
let options: ts.CompilerOptions;
5958
// equivalent to the files that will be passed on the command line
6059
let toBeCompiled: Harness.Compiler.TestFile[];
@@ -66,7 +65,7 @@ class CompilerBaselineRunner extends RunnerBase {
6665
const content = Harness.IO.readFile(fileName);
6766
const testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName);
6867
const units = testCaseContent.testUnitData;
69-
tcSettings = testCaseContent.settings;
68+
harnessSettings = testCaseContent.settings;
7069
lastUnit = units[units.length - 1];
7170
const rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/";
7271
// We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test)
@@ -88,12 +87,11 @@ class CompilerBaselineRunner extends RunnerBase {
8887
});
8988
}
9089

91-
const output = Harness.Compiler.HarnessCompiler.compileFiles(
92-
toBeCompiled, otherFiles, tcSettings, /* options */ undefined, /* currentDirectory */ undefined);
90+
const output = Harness.Compiler.compileFiles(
91+
toBeCompiled, otherFiles, harnessSettings, /* options */ undefined, /* currentDirectory */ undefined);
9392

9493
options = output.options;
9594
result = output.result;
96-
program = output.program;
9795
});
9896

9997
after(() => {
@@ -102,7 +100,6 @@ class CompilerBaselineRunner extends RunnerBase {
102100
justName = undefined;
103101
lastUnit = undefined;
104102
result = undefined;
105-
program = undefined;
106103
options = undefined;
107104
toBeCompiled = undefined;
108105
otherFiles = undefined;
@@ -175,8 +172,8 @@ class CompilerBaselineRunner extends RunnerBase {
175172
}
176173

177174
const declFileCompilationResult =
178-
Harness.Compiler.HarnessCompiler.compileDeclarationFiles(
179-
toBeCompiled, otherFiles, result, tcSettings, options, /*currentDirectory*/ undefined);
175+
Harness.Compiler.compileDeclarationFiles(
176+
toBeCompiled, otherFiles, result, harnessSettings, options, /*currentDirectory*/ undefined);
180177

181178
if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) {
182179
jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n";
@@ -247,6 +244,7 @@ class CompilerBaselineRunner extends RunnerBase {
247244
// These types are equivalent, but depend on what order the compiler observed
248245
// certain parts of the program.
249246

247+
const program = result.program;
250248
const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName));
251249

252250
const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true);

0 commit comments

Comments
 (0)