@@ -566,6 +566,7 @@ var TypeScript;
566566 DiagnosticCode[DiagnosticCode["Cannot_find_the_common_subdirectory_path_for_the_input_files"] = 273] = "Cannot_find_the_common_subdirectory_path_for_the_input_files";
567567 DiagnosticCode[DiagnosticCode["Cannot_compile_dynamic_modules_when_emitting_into_single_file"] = 274] = "Cannot_compile_dynamic_modules_when_emitting_into_single_file";
568568 DiagnosticCode[DiagnosticCode["Emit_Error__0"] = 275] = "Emit_Error__0";
569+ DiagnosticCode[DiagnosticCode["Unsupported_encoding_for_file__0"] = 276] = "Unsupported_encoding_for_file__0";
569570 })(TypeScript.DiagnosticCode || (TypeScript.DiagnosticCode = {}));
570571 var DiagnosticCode = TypeScript.DiagnosticCode;
571572})(TypeScript || (TypeScript = {}));
@@ -1951,6 +1952,11 @@ var TypeScript;
19511952 category: 1 /* Error */,
19521953 message: "Emit Error: {0}.",
19531954 code: 5011
1955+ },
1956+ Unsupported_encoding_for_file__0: {
1957+ category: 1 /* Error */,
1958+ message: "Unsupported encoding for file: '{0}'.",
1959+ code: 5013
19541960 }
19551961 };
19561962
@@ -2604,7 +2610,14 @@ var Environment = (function () {
26042610 releaseStreamObject(streamObj);
26052611 return new FileInformation(contents, byteOrderMark);
26062612 } catch (err) {
2607- throw new Error("Error reading file \"" + path + "\": " + err.message);
2613+ var error = new Error(err.message);
2614+
2615+ var message;
2616+ if (err.number === -2147024809) {
2617+ error.isUnsupportedEncoding = true;
2618+ }
2619+
2620+ throw error;
26082621 }
26092622 },
26102623 writeFile: function (path, contents, writeByteOrderMark) {
@@ -30555,13 +30568,13 @@ var TypeScript;
3055530568 this.emitThis();
3055630569 this.writeToOutput(".");
3055730570 }
30558- } else if (pullSymbolContainerKind === 4 /* Container */ || pullSymbolContainerKind === 64 /* Enum */ || pullSymbolContainer.hasFlag(32768 /* InitializedModule */ | 131072 /* InitializedEnum */)) {
30571+ } else if (TypeScript.PullHelpers.symbolIsModule(pullSymbolContainer) || pullSymbolContainerKind === 64 /* Enum */ || pullSymbolContainer.hasFlag(32768 /* InitializedModule */ | 131072 /* InitializedEnum */)) {
3055930572 if (pullSymbolKind === 4096 /* Property */ || pullSymbolKind === 67108864 /* EnumMember */) {
30560- this.writeToOutput(pullSymbolContainer.getName () + ".");
30573+ this.writeToOutput(pullSymbolContainer.getDisplayName () + ".");
3056130574 } else if (pullSymbol.hasFlag(1 /* Exported */) && pullSymbolKind === 1024 /* Variable */ && !pullSymbol.hasFlag(32768 /* InitializedModule */ | 131072 /* InitializedEnum */)) {
30562- this.writeToOutput(pullSymbolContainer.getName () + ".");
30575+ this.writeToOutput(pullSymbolContainer.getDisplayName () + ".");
3056330576 } else if (pullSymbol.hasFlag(1 /* Exported */) && !this.symbolIsUsedInItsEnclosingContainer(pullSymbol)) {
30564- this.writeToOutput(pullSymbolContainer.getName () + ".");
30577+ this.writeToOutput(pullSymbolContainer.getDisplayName () + ".");
3056530578 }
3056630579 } else if (pullSymbolContainerKind === 32 /* DynamicModule */ || pullSymbolContainer.hasFlag(65536 /* InitializedDynamicModule */)) {
3056730580 if (pullSymbolKind === 4096 /* Property */) {
@@ -31537,17 +31550,28 @@ var TypeScript;
3153731550 try {
3153831551 resolvedFile.fileInformation = ioHost.readFile(normalizedPath);
3153931552 } catch (err1) {
31553+ if (err1.isUnsupportedEncoding) {
31554+ resolutionDispatcher.errorReporter.addDiagnostic(new TypeScript.Diagnostic(null, 0, 0, 276 /* Unsupported_encoding_for_file__0 */, [normalizedPath]));
31555+ return;
31556+ }
31557+
3154031558 if (TypeScript.isTSFile(normalizedPath)) {
3154131559 normalizedPath = TypeScript.changePathToDTS(normalizedPath);
3154231560 TypeScript.CompilerDiagnostics.debugPrint(" Reading code from " + normalizedPath);
3154331561 resolvedFile.fileInformation = ioHost.readFile(normalizedPath);
3154431562 }
3154531563 }
31564+
3154631565 TypeScript.CompilerDiagnostics.debugPrint(" Found code at " + normalizedPath);
3154731566
3154831567 resolvedFile.path = normalizedPath;
3154931568 this.visited[absoluteModuleID] = true;
3155031569 } catch (err4) {
31570+ if (err4.isUnsupportedEncoding) {
31571+ resolutionDispatcher.errorReporter.addDiagnostic(new TypeScript.Diagnostic(null, 0, 0, 276 /* Unsupported_encoding_for_file__0 */, [normalizedPath]));
31572+ return;
31573+ }
31574+
3155131575 TypeScript.CompilerDiagnostics.debugPrint(" Did not find code for " + referencePath);
3155231576
3155331577 return false;
@@ -33987,6 +34011,21 @@ var TypeScript;
3398734011
3398834012 return PullSymbol.getIsExternallyVisible(container, this, inIsExternallyVisibleSymbols);
3398934013 };
34014+
34015+ PullSymbol.prototype.isModule = function () {
34016+ return this.getKind() == 4 /* Container */ || this.isOneDeclarationOfKind(4 /* Container */);
34017+ };
34018+
34019+ PullSymbol.prototype.isOneDeclarationOfKind = function (kind) {
34020+ var decls = this.getDeclarations();
34021+ for (var i = 0; i < decls.length; i++) {
34022+ if (decls[i].getKind() === kind) {
34023+ return true;
34024+ }
34025+ }
34026+
34027+ return false;
34028+ };
3399034029 return PullSymbol;
3399134030 })();
3399234031 TypeScript.PullSymbol = PullSymbol;
@@ -35454,7 +35493,7 @@ var TypeScript;
3545435493 typars = this.getTypeParameters();
3545535494 }
3545635495
35457- builder.add(PullSymbol.getTypeParameterStringEx(typars, this , getTypeParamMarkerInfo, useConstraintInName));
35496+ builder.add(PullSymbol.getTypeParameterStringEx(typars, scopeSymbol , getTypeParamMarkerInfo, useConstraintInName));
3545835497
3545935498 return builder;
3546035499 };
@@ -36642,6 +36681,11 @@ var TypeScript;
3664236681
3664336682 prevSpecializationSignature = decl.getSpecializingSignatureSymbol();
3664436683 decl.setSpecializingSignatureSymbol(newSignature);
36684+
36685+ if (!(signature.isResolved() || signature.isResolving())) {
36686+ resolver.resolveDeclaredSymbol(signature, enclosingDecl, new TypeScript.PullTypeResolutionContext());
36687+ }
36688+
3664536689 resolver.resolveAST(declAST, false, newTypeDecl, context);
3664636690 decl.setSpecializingSignatureSymbol(prevSpecializationSignature);
3664736691
@@ -36704,6 +36748,11 @@ var TypeScript;
3670436748
3670536749 prevSpecializationSignature = decl.getSpecializingSignatureSymbol();
3670636750 decl.setSpecializingSignatureSymbol(newSignature);
36751+
36752+ if (!(signature.isResolved() || signature.isResolving())) {
36753+ resolver.resolveDeclaredSymbol(signature, enclosingDecl, new TypeScript.PullTypeResolutionContext());
36754+ }
36755+
3670736756 resolver.resolveAST(declAST, false, newTypeDecl, context);
3670836757 decl.setSpecializingSignatureSymbol(prevSpecializationSignature);
3670936758
@@ -36766,6 +36815,11 @@ var TypeScript;
3676636815
3676736816 prevSpecializationSignature = decl.getSpecializingSignatureSymbol();
3676836817 decl.setSpecializingSignatureSymbol(newSignature);
36818+
36819+ if (!(signature.isResolved() || signature.isResolving())) {
36820+ resolver.resolveDeclaredSymbol(signature, enclosingDecl, new TypeScript.PullTypeResolutionContext());
36821+ }
36822+
3676936823 resolver.resolveAST(declAST, false, newTypeDecl, context);
3677036824 decl.setSpecializingSignatureSymbol(prevSpecializationSignature);
3677136825
@@ -39123,6 +39177,9 @@ var TypeScript;
3912339177 }
3912439178 } else if (typeExprSymbol.isError()) {
3912539179 context.setTypeInContext(declSymbol, typeExprSymbol);
39180+ if (declParameterSymbol) {
39181+ context.setTypeInContext(declParameterSymbol, typeExprSymbol);
39182+ }
3912639183 } else {
3912739184 if (typeExprSymbol.isNamedTypeSymbol() && typeExprSymbol.isGeneric() && !typeExprSymbol.isTypeParameter() && typeExprSymbol.isResolved() && !typeExprSymbol.getIsSpecialized() && typeExprSymbol.getTypeParameters().length && (typeExprSymbol.getTypeArguments() == null && !this.isArrayOrEquivalent(typeExprSymbol)) && this.isTypeRefWithoutTypeArgs(varDecl.typeExpr)) {
3912839185 context.postError(this.unitPath, varDecl.typeExpr.minChar, varDecl.typeExpr.getLength(), 239 /* Generic_type_references_must_include_all_type_arguments */, null, enclosingDecl, true);
@@ -39924,6 +39981,14 @@ var TypeScript;
3992439981 }
3992539982 }
3992639983
39984+ if (!nameSymbol) {
39985+ nameSymbol = this.getSymbolFromDeclPath(id, declPath, 256 /* TypeAlias */);
39986+
39987+ if (nameSymbol && !nameSymbol.isAlias()) {
39988+ nameSymbol = null;
39989+ }
39990+ }
39991+
3992739992 if (!nameSymbol) {
3992839993 return SymbolAndDiagnostics.create(this.getNewErrorTypeSymbol(null, id), [context.postError(this.unitPath, nameAST.minChar, nameAST.getLength(), 164 /* Could_not_find_symbol__0_ */, [nameAST.actualText])]);
3992939994 }
@@ -40259,7 +40324,11 @@ var TypeScript;
4025940324 typeArg = this.specializeTypeToAny(typeArg, enclosingDecl, context);
4026040325 }
4026140326
40262- typeArgs[i] = context.findSpecializationForType(typeArg);
40327+ if (!(typeArg.isTypeParameter() && (typeArg).isFunctionTypeParameter() && context.isSpecializingSignatureAtCallSite && !context.isSpecializingConstructorMethod)) {
40328+ typeArgs[i] = context.findSpecializationForType(typeArg);
40329+ } else {
40330+ typeArgs[i] = typeArg;
40331+ }
4026340332 }
4026440333 }
4026540334
@@ -48198,6 +48267,14 @@ var TypeScript;
4819848267 }
4819948268
4820048269 parent = parentDecl.getSymbol();
48270+ if (parent) {
48271+ var parentDeclKind = parentDecl.getKind();
48272+ if (parentDeclKind == 262144 /* GetAccessor */) {
48273+ parent = (parent).getGetter();
48274+ } else if (parentDeclKind == 524288 /* SetAccessor */) {
48275+ parent = (parent).getSetter();
48276+ }
48277+ }
4820148278
4820248279 if (parent) {
4820348280 if (returnInstanceType && parent.isType() && parent.isContainer()) {
@@ -51313,6 +51390,22 @@ var TypeScript;
5131351390 return source && ((source.getKind() & (64 /* Enum */ | 67108864 /* EnumMember */)) || source.hasFlag(131072 /* InitializedEnum */));
5131451391 }
5131551392 PullHelpers.symbolIsEnum = symbolIsEnum;
51393+
51394+ function symbolIsModule(symbol) {
51395+ return symbol.getKind() == 4 /* Container */ || isOneDeclarationOfKind(symbol, 4 /* Container */);
51396+ }
51397+ PullHelpers.symbolIsModule = symbolIsModule;
51398+
51399+ function isOneDeclarationOfKind(symbol, kind) {
51400+ var decls = symbol.getDeclarations();
51401+ for (var i = 0; i < decls.length; i++) {
51402+ if (decls[i].getKind() === kind) {
51403+ return true;
51404+ }
51405+ }
51406+
51407+ return false;
51408+ }
5131651409 })(TypeScript.PullHelpers || (TypeScript.PullHelpers = {}));
5131751410 var PullHelpers = TypeScript.PullHelpers;
5131851411})(TypeScript || (TypeScript = {}));
@@ -56269,7 +56362,7 @@ var BatchCompiler = (function () {
5626956362 this.ioHost = ioHost;
5627056363 this.resolvedEnvironment = null;
5627156364 this.hasResolveErrors = false;
56272- this.compilerVersion = "0.9.0.0 ";
56365+ this.compilerVersion = "0.9.0.1 ";
5627356366 this.printedVersion = false;
5627456367 this.errorReporter = null;
5627556368 this.compilationSettings = new TypeScript.CompilationSettings();
@@ -56311,7 +56404,13 @@ var BatchCompiler = (function () {
5631156404 var code = this.resolvedEnvironment.code[iCode];
5631256405
5631356406 if (!this.compilationSettings.resolve) {
56314- code.fileInformation = this.ioHost.readFile(code.path);
56407+ try {
56408+ code.fileInformation = this.ioHost.readFile(code.path);
56409+ } catch (e) {
56410+ if (e.isUnsupportedEncoding) {
56411+ this.errorReporter.addDiagnostic(new TypeScript.Diagnostic(null, 0, 0, 276 /* Unsupported_encoding_for_file__0 */, [code.path]));
56412+ }
56413+ }
5631556414
5631656415 if (this.compilationSettings.generateDeclarationFiles) {
5631756416 TypeScript.CompilerDiagnostics.assert(code.referencedFiles === null, "With no resolve option, referenced files need to null");
@@ -56402,7 +56501,13 @@ var BatchCompiler = (function () {
5640256501 this.ioHost.stdout.WriteLine("Consuming " + this.resolvedEnvironment.code[iCode].path + "...");
5640356502
5640456503 if (!this.compilationSettings.resolve) {
56405- code.fileInformation = this.ioHost.readFile(code.path);
56504+ try {
56505+ code.fileInformation = this.ioHost.readFile(code.path);
56506+ } catch (e) {
56507+ if (e.isUnsupportedEncoding) {
56508+ this.errorReporter.addDiagnostic(new TypeScript.Diagnostic(null, 0, 0, 276 /* Unsupported_encoding_for_file__0 */, [code.path]));
56509+ }
56510+ }
5640656511
5640756512 if (this.compilationSettings.generateDeclarationFiles) {
5640856513 TypeScript.CompilerDiagnostics.assert(code.referencedFiles === null, "With no resolve option, referenced files need to null");
0 commit comments