mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-15 22:15:05 -05:00
Merge pull request #11392 from Microsoft/release-2.0.5_emitDTS
[Release-2.5] Port fix from master to release-2.0.5: Serialize type alias when type-alias is not accessible and emit generic
This commit is contained in:
@@ -1744,7 +1744,15 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult {
|
||||
/**
|
||||
* Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested
|
||||
*
|
||||
* @param symbol a Symbol to check if accessible
|
||||
* @param enclosingDeclaration a Node containing reference to the symbol
|
||||
* @param meaning a SymbolFlags to check if such meaning of the symbol is accessible
|
||||
* @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible
|
||||
*/
|
||||
function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasesToMakeVisible: boolean): SymbolAccessibilityResult {
|
||||
if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) {
|
||||
const initialSymbol = symbol;
|
||||
let meaningToLook = meaning;
|
||||
@@ -1752,7 +1760,7 @@ namespace ts {
|
||||
// Symbol is accessible if it by itself is accessible
|
||||
const accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false);
|
||||
if (accessibleSymbolChain) {
|
||||
const hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
const hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return <SymbolAccessibilityResult>{
|
||||
accessibility: SymbolAccessibility.NotAccessible,
|
||||
@@ -1816,7 +1824,7 @@ namespace ts {
|
||||
return isAmbientModule(declaration) || (declaration.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(<SourceFile>declaration));
|
||||
}
|
||||
|
||||
function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult {
|
||||
function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMakeVisible: boolean): SymbolVisibilityResult {
|
||||
let aliasesToMakeVisible: AnyImportSyntax[];
|
||||
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
|
||||
return undefined;
|
||||
@@ -1832,14 +1840,19 @@ namespace ts {
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & NodeFlags.Export) && // import clause without export
|
||||
isDeclarationVisible(<Declaration>anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
// In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
|
||||
// we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
|
||||
// since we will do the emitting later in trackSymbol.
|
||||
if (shouldComputeAliasToMakeVisible) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1874,7 +1887,7 @@ namespace ts {
|
||||
const symbol = resolveName(enclosingDeclaration, (<Identifier>firstIdentifier).text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
// Verify if the symbol is accessible
|
||||
return (symbol && hasVisibleDeclarations(symbol)) || <SymbolVisibilityResult>{
|
||||
return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || <SymbolVisibilityResult>{
|
||||
accessibility: SymbolAccessibility.NotAccessible,
|
||||
errorSymbolName: getTextOfNode(firstIdentifier),
|
||||
errorNode: firstIdentifier
|
||||
@@ -2152,14 +2165,16 @@ namespace ts {
|
||||
// The specified symbol flags need to be reinterpreted as type flags
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, nextFlags);
|
||||
}
|
||||
else if (!(flags & TypeFormatFlags.InTypeAlias) && type.flags & (TypeFlags.Anonymous | TypeFlags.UnionOrIntersection) && type.aliasSymbol) {
|
||||
if (type.flags & TypeFlags.Anonymous || !(flags & TypeFormatFlags.UseTypeAliasValue)) {
|
||||
const typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(<UnionOrIntersectionType>type, nextFlags);
|
||||
}
|
||||
else if (!(flags & TypeFormatFlags.InTypeAlias) && ((type.flags & TypeFlags.Anonymous && !(<AnonymousType>type).target) || type.flags & TypeFlags.UnionOrIntersection) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible) {
|
||||
// We emit inferred type as type-alias at the current location if all the following is true
|
||||
// the input type is has alias symbol that is accessible
|
||||
// the input type is a union, intersection or anonymous type that is fully instantiated (if not we want to keep dive into)
|
||||
// e.g.: export type Bar<X, Y> = () => [X, Y];
|
||||
// export type Foo<Y> = Bar<any, Y>;
|
||||
// export const y = (x: Foo<string>) => 1 // we want to emit as ...x: () => [any, string])
|
||||
const typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else if (type.flags & TypeFlags.UnionOrIntersection) {
|
||||
writeUnionOrIntersectionType(<UnionOrIntersectionType>type, nextFlags);
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true));
|
||||
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -341,7 +341,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -563,7 +563,7 @@ namespace ts {
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -1025,7 +1025,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(<ClassLikeDeclaration>enclosingDeclaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(<ClassLikeDeclaration>enclosingDeclaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
|
||||
|
||||
@@ -1949,7 +1949,6 @@ namespace ts {
|
||||
UseFullyQualifiedType = 0x00000080, // Write out the fully qualified type name (eg. Module.Type, instead of Type)
|
||||
InFirstTypeArgument = 0x00000100, // Writing first type argument of the instantiated type
|
||||
InTypeAlias = 0x00000200, // Writing type in type alias declaration
|
||||
UseTypeAliasValue = 0x00000400, // Serialize the type instead of using type-alias. This is needed when we emit declaration file.
|
||||
}
|
||||
|
||||
export const enum SymbolFormatFlags {
|
||||
@@ -2052,7 +2051,7 @@ namespace ts {
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult;
|
||||
isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
|
||||
@@ -62,21 +62,21 @@ declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection;
|
||||
>HTMLCollection : HTMLCollection
|
||||
|
||||
type EventTargetLike = {a: string} | HTMLCollection | NodeList;
|
||||
>EventTargetLike : EventTargetLike
|
||||
>EventTargetLike : NodeList | HTMLCollection | { a: string; }
|
||||
>a : string
|
||||
>HTMLCollection : HTMLCollection
|
||||
>NodeList : NodeList
|
||||
|
||||
var sourceObj: EventTargetLike = <any>undefined;
|
||||
>sourceObj : EventTargetLike
|
||||
>EventTargetLike : EventTargetLike
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
>EventTargetLike : NodeList | HTMLCollection | { a: string; }
|
||||
><any>undefined : any
|
||||
>undefined : undefined
|
||||
|
||||
if (isNodeList(sourceObj)) {
|
||||
>isNodeList(sourceObj) : boolean
|
||||
>isNodeList : (sourceObj: any) => sourceObj is NodeList
|
||||
>sourceObj : EventTargetLike
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : number
|
||||
@@ -87,7 +87,7 @@ if (isNodeList(sourceObj)) {
|
||||
if (isHTMLCollection(sourceObj)) {
|
||||
>isHTMLCollection(sourceObj) : boolean
|
||||
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
|
||||
>sourceObj : EventTargetLike
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : number
|
||||
@@ -99,7 +99,7 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
|
||||
>isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean
|
||||
>isNodeList(sourceObj) : boolean
|
||||
>isNodeList : (sourceObj: any) => sourceObj is NodeList
|
||||
>sourceObj : EventTargetLike
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
>isHTMLCollection(sourceObj) : boolean
|
||||
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
|
||||
>sourceObj : HTMLCollection | { a: string; }
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [declarationEmitArrayTypesFromGenericArrayUsage.ts]
|
||||
interface A extends Array<string> { }
|
||||
|
||||
|
||||
//// [declarationEmitArrayTypesFromGenericArrayUsage.js]
|
||||
|
||||
|
||||
//// [declarationEmitArrayTypesFromGenericArrayUsage.d.ts]
|
||||
interface A extends Array<string> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/declarationEmitArrayTypesFromGenericArrayUsage.ts ===
|
||||
interface A extends Array<string> { }
|
||||
>A : Symbol(A, Decl(declarationEmitArrayTypesFromGenericArrayUsage.ts, 0, 0))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/declarationEmitArrayTypesFromGenericArrayUsage.ts ===
|
||||
interface A extends Array<string> { }
|
||||
>A : A
|
||||
>Array : T[]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_bindingPatterns.ts]
|
||||
//// [declarationEmitBindingPatterns.ts]
|
||||
|
||||
const k = ({x: z = 'y'}) => { }
|
||||
|
||||
@@ -6,7 +6,7 @@ var a;
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
}
|
||||
|
||||
//// [declarationEmit_bindingPatterns.js]
|
||||
//// [declarationEmitBindingPatterns.js]
|
||||
var k = function (_a) {
|
||||
var _b = _a.x, z = _b === void 0 ? 'y' : _b;
|
||||
};
|
||||
@@ -18,7 +18,7 @@ function f(_a, _b, _c) {
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmit_bindingPatterns.d.ts]
|
||||
//// [declarationEmitBindingPatterns.d.ts]
|
||||
declare const k: ({x: z}: {
|
||||
x?: string;
|
||||
}) => void;
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/declarationEmitBindingPatterns.ts ===
|
||||
|
||||
const k = ({x: z = 'y'}) => { }
|
||||
>k : Symbol(k, Decl(declarationEmitBindingPatterns.ts, 1, 5))
|
||||
>x : Symbol(x)
|
||||
>z : Symbol(z, Decl(declarationEmitBindingPatterns.ts, 1, 12))
|
||||
|
||||
var a;
|
||||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3))
|
||||
|
||||
function f({} = a, [] = a, { p: {} = a} = a) {
|
||||
>f : Symbol(f, Decl(declarationEmitBindingPatterns.ts, 3, 6))
|
||||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3))
|
||||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3))
|
||||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3))
|
||||
>a : Symbol(a, Decl(declarationEmitBindingPatterns.ts, 3, 3))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_bindingPatterns.ts ===
|
||||
=== tests/cases/compiler/declarationEmitBindingPatterns.ts ===
|
||||
|
||||
const k = ({x: z = 'y'}) => { }
|
||||
>k : ({x: z}: { x?: string; }) => void
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_classMemberNameConflict.ts]
|
||||
//// [declarationEmitClassMemberNameConflict.ts]
|
||||
|
||||
export class C1 {
|
||||
C1() { } // has to be the same as the class name
|
||||
@@ -36,7 +36,7 @@ export class C4 {
|
||||
}
|
||||
}
|
||||
|
||||
//// [declarationEmit_classMemberNameConflict.js]
|
||||
//// [declarationEmitClassMemberNameConflict.js]
|
||||
"use strict";
|
||||
var C1 = (function () {
|
||||
function C1() {
|
||||
@@ -93,7 +93,7 @@ var C4 = (function () {
|
||||
exports.C4 = C4;
|
||||
|
||||
|
||||
//// [declarationEmit_classMemberNameConflict.d.ts]
|
||||
//// [declarationEmitClassMemberNameConflict.d.ts]
|
||||
export declare class C1 {
|
||||
C1(): void;
|
||||
bar(): (t: typeof C1) => void;
|
||||
@@ -0,0 +1,70 @@
|
||||
=== tests/cases/compiler/declarationEmitClassMemberNameConflict.ts ===
|
||||
|
||||
export class C1 {
|
||||
>C1 : Symbol(C1, Decl(declarationEmitClassMemberNameConflict.ts, 0, 0))
|
||||
|
||||
C1() { } // has to be the same as the class name
|
||||
>C1 : Symbol(C1.C1, Decl(declarationEmitClassMemberNameConflict.ts, 1, 17))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(C1.bar, Decl(declarationEmitClassMemberNameConflict.ts, 2, 12))
|
||||
|
||||
return function (t: typeof C1) {
|
||||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 5, 25))
|
||||
>C1 : Symbol(C1, Decl(declarationEmitClassMemberNameConflict.ts, 0, 0))
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class C2 {
|
||||
>C2 : Symbol(C2, Decl(declarationEmitClassMemberNameConflict.ts, 8, 1))
|
||||
|
||||
C2: any // has to be the same as the class name
|
||||
>C2 : Symbol(C2.C2, Decl(declarationEmitClassMemberNameConflict.ts, 10, 17))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(C2.bar, Decl(declarationEmitClassMemberNameConflict.ts, 11, 11))
|
||||
|
||||
return function (t: typeof C2) {
|
||||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 14, 25))
|
||||
>C2 : Symbol(C2, Decl(declarationEmitClassMemberNameConflict.ts, 8, 1))
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class C3 {
|
||||
>C3 : Symbol(C3, Decl(declarationEmitClassMemberNameConflict.ts, 17, 1))
|
||||
|
||||
get C3() { return 0; } // has to be the same as the class name
|
||||
>C3 : Symbol(C3.C3, Decl(declarationEmitClassMemberNameConflict.ts, 19, 17))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(C3.bar, Decl(declarationEmitClassMemberNameConflict.ts, 20, 26))
|
||||
|
||||
return function (t: typeof C3) {
|
||||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 23, 25))
|
||||
>C3 : Symbol(C3, Decl(declarationEmitClassMemberNameConflict.ts, 17, 1))
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class C4 {
|
||||
>C4 : Symbol(C4, Decl(declarationEmitClassMemberNameConflict.ts, 26, 1))
|
||||
|
||||
set C4(v) { } // has to be the same as the class name
|
||||
>C4 : Symbol(C4.C4, Decl(declarationEmitClassMemberNameConflict.ts, 28, 17))
|
||||
>v : Symbol(v, Decl(declarationEmitClassMemberNameConflict.ts, 29, 11))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(C4.bar, Decl(declarationEmitClassMemberNameConflict.ts, 29, 17))
|
||||
|
||||
return function (t: typeof C4) {
|
||||
>t : Symbol(t, Decl(declarationEmitClassMemberNameConflict.ts, 32, 25))
|
||||
>C4 : Symbol(C4, Decl(declarationEmitClassMemberNameConflict.ts, 26, 1))
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_classMemberNameConflict.ts ===
|
||||
=== tests/cases/compiler/declarationEmitClassMemberNameConflict.ts ===
|
||||
|
||||
export class C1 {
|
||||
>C1 : C1
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_classMemberNameConflict2.ts]
|
||||
//// [declarationEmitClassMemberNameConflict2.ts]
|
||||
|
||||
const Bar = 'bar';
|
||||
|
||||
@@ -21,7 +21,7 @@ class Foo {
|
||||
Hello2 = Hello1;
|
||||
}
|
||||
|
||||
//// [declarationEmit_classMemberNameConflict2.js]
|
||||
//// [declarationEmitClassMemberNameConflict2.js]
|
||||
var Bar = 'bar';
|
||||
var Hello;
|
||||
(function (Hello) {
|
||||
@@ -44,7 +44,7 @@ var Foo = (function () {
|
||||
}());
|
||||
|
||||
|
||||
//// [declarationEmit_classMemberNameConflict2.d.ts]
|
||||
//// [declarationEmitClassMemberNameConflict2.d.ts]
|
||||
declare const Bar: string;
|
||||
declare enum Hello {
|
||||
World = 0,
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/declarationEmitClassMemberNameConflict2.ts ===
|
||||
|
||||
const Bar = 'bar';
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitClassMemberNameConflict2.ts, 1, 5))
|
||||
|
||||
enum Hello {
|
||||
>Hello : Symbol(Hello, Decl(declarationEmitClassMemberNameConflict2.ts, 1, 18))
|
||||
|
||||
World
|
||||
>World : Symbol(Hello.World, Decl(declarationEmitClassMemberNameConflict2.ts, 3, 12))
|
||||
}
|
||||
|
||||
enum Hello1 {
|
||||
>Hello1 : Symbol(Hello1, Decl(declarationEmitClassMemberNameConflict2.ts, 5, 1))
|
||||
|
||||
World1
|
||||
>World1 : Symbol(Hello1.World1, Decl(declarationEmitClassMemberNameConflict2.ts, 7, 13))
|
||||
}
|
||||
|
||||
class Foo {
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitClassMemberNameConflict2.ts, 9, 1))
|
||||
|
||||
// Same names + string => OK
|
||||
Bar = Bar;
|
||||
>Bar : Symbol(Foo.Bar, Decl(declarationEmitClassMemberNameConflict2.ts, 11, 11))
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitClassMemberNameConflict2.ts, 1, 5))
|
||||
|
||||
// Same names + enum => OK
|
||||
Hello = Hello;
|
||||
>Hello : Symbol(Foo.Hello, Decl(declarationEmitClassMemberNameConflict2.ts, 13, 14))
|
||||
>Hello : Symbol(Hello, Decl(declarationEmitClassMemberNameConflict2.ts, 1, 18))
|
||||
|
||||
// Different names + enum => OK
|
||||
Hello2 = Hello1;
|
||||
>Hello2 : Symbol(Foo.Hello2, Decl(declarationEmitClassMemberNameConflict2.ts, 16, 18))
|
||||
>Hello1 : Symbol(Hello1, Decl(declarationEmitClassMemberNameConflict2.ts, 5, 1))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_classMemberNameConflict2.ts ===
|
||||
=== tests/cases/compiler/declarationEmitClassMemberNameConflict2.ts ===
|
||||
|
||||
const Bar = 'bar';
|
||||
>Bar : string
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/compiler/declarationEmit_exportAssignment.ts] ////
|
||||
//// [tests/cases/compiler/declarationEmitExportAssignment.ts] ////
|
||||
|
||||
//// [utils.ts]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/compiler/declarationEmit_exportDeclaration.ts] ////
|
||||
//// [tests/cases/compiler/declarationEmitExportDeclaration.ts] ////
|
||||
|
||||
//// [utils.ts]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_expressionInExtends.ts]
|
||||
//// [declarationEmitExpressionInExtends.ts]
|
||||
|
||||
var x: {
|
||||
new<T>(s: any): Q;
|
||||
@@ -14,7 +14,7 @@ class B extends x<string> {
|
||||
var q: B;
|
||||
q.s;
|
||||
|
||||
//// [declarationEmit_expressionInExtends.js]
|
||||
//// [declarationEmitExpressionInExtends.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -37,7 +37,7 @@ var q;
|
||||
q.s;
|
||||
|
||||
|
||||
//// [declarationEmit_expressionInExtends.d.ts]
|
||||
//// [declarationEmitExpressionInExtends.d.ts]
|
||||
declare var x: {
|
||||
new <T>(s: any): Q;
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/declarationEmitExpressionInExtends.ts ===
|
||||
|
||||
var x: {
|
||||
>x : Symbol(x, Decl(declarationEmitExpressionInExtends.ts, 1, 3))
|
||||
|
||||
new<T>(s: any): Q;
|
||||
>T : Symbol(T, Decl(declarationEmitExpressionInExtends.ts, 2, 8))
|
||||
>s : Symbol(s, Decl(declarationEmitExpressionInExtends.ts, 2, 11))
|
||||
>Q : Symbol(Q, Decl(declarationEmitExpressionInExtends.ts, 3, 1))
|
||||
}
|
||||
|
||||
class Q {
|
||||
>Q : Symbol(Q, Decl(declarationEmitExpressionInExtends.ts, 3, 1))
|
||||
|
||||
s: string;
|
||||
>s : Symbol(Q.s, Decl(declarationEmitExpressionInExtends.ts, 5, 9))
|
||||
}
|
||||
|
||||
class B extends x<string> {
|
||||
>B : Symbol(B, Decl(declarationEmitExpressionInExtends.ts, 7, 1))
|
||||
>x : Symbol(x, Decl(declarationEmitExpressionInExtends.ts, 1, 3))
|
||||
}
|
||||
|
||||
var q: B;
|
||||
>q : Symbol(q, Decl(declarationEmitExpressionInExtends.ts, 12, 3))
|
||||
>B : Symbol(B, Decl(declarationEmitExpressionInExtends.ts, 7, 1))
|
||||
|
||||
q.s;
|
||||
>q.s : Symbol(Q.s, Decl(declarationEmitExpressionInExtends.ts, 5, 9))
|
||||
>q : Symbol(q, Decl(declarationEmitExpressionInExtends.ts, 12, 3))
|
||||
>s : Symbol(Q.s, Decl(declarationEmitExpressionInExtends.ts, 5, 9))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_expressionInExtends.ts ===
|
||||
=== tests/cases/compiler/declarationEmitExpressionInExtends.ts ===
|
||||
|
||||
var x: {
|
||||
>x : new <T>(s: any) => Q
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_expressionInExtends2.ts]
|
||||
//// [declarationEmitExpressionInExtends2.ts]
|
||||
|
||||
class C<T, U> {
|
||||
x: T;
|
||||
@@ -12,7 +12,7 @@ function getClass<T>(c: T) {
|
||||
class MyClass extends getClass(2) <string, number> {
|
||||
}
|
||||
|
||||
//// [declarationEmit_expressionInExtends2.js]
|
||||
//// [declarationEmitExpressionInExtends2.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -35,7 +35,7 @@ var MyClass = (function (_super) {
|
||||
}(getClass(2)));
|
||||
|
||||
|
||||
//// [declarationEmit_expressionInExtends2.d.ts]
|
||||
//// [declarationEmitExpressionInExtends2.d.ts]
|
||||
declare class C<T, U> {
|
||||
x: T;
|
||||
y: U;
|
||||
@@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/declarationEmitExpressionInExtends2.ts ===
|
||||
|
||||
class C<T, U> {
|
||||
>C : Symbol(C, Decl(declarationEmitExpressionInExtends2.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitExpressionInExtends2.ts, 1, 8))
|
||||
>U : Symbol(U, Decl(declarationEmitExpressionInExtends2.ts, 1, 10))
|
||||
|
||||
x: T;
|
||||
>x : Symbol(C.x, Decl(declarationEmitExpressionInExtends2.ts, 1, 15))
|
||||
>T : Symbol(T, Decl(declarationEmitExpressionInExtends2.ts, 1, 8))
|
||||
|
||||
y: U;
|
||||
>y : Symbol(C.y, Decl(declarationEmitExpressionInExtends2.ts, 2, 9))
|
||||
>U : Symbol(U, Decl(declarationEmitExpressionInExtends2.ts, 1, 10))
|
||||
}
|
||||
|
||||
function getClass<T>(c: T) {
|
||||
>getClass : Symbol(getClass, Decl(declarationEmitExpressionInExtends2.ts, 4, 1))
|
||||
>T : Symbol(T, Decl(declarationEmitExpressionInExtends2.ts, 6, 18))
|
||||
>c : Symbol(c, Decl(declarationEmitExpressionInExtends2.ts, 6, 21))
|
||||
>T : Symbol(T, Decl(declarationEmitExpressionInExtends2.ts, 6, 18))
|
||||
|
||||
return C;
|
||||
>C : Symbol(C, Decl(declarationEmitExpressionInExtends2.ts, 0, 0))
|
||||
}
|
||||
|
||||
class MyClass extends getClass(2) <string, number> {
|
||||
>MyClass : Symbol(MyClass, Decl(declarationEmitExpressionInExtends2.ts, 8, 1))
|
||||
>getClass : Symbol(getClass, Decl(declarationEmitExpressionInExtends2.ts, 4, 1))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_expressionInExtends2.ts ===
|
||||
=== tests/cases/compiler/declarationEmitExpressionInExtends2.ts ===
|
||||
|
||||
class C<T, U> {
|
||||
>C : C<T, U>
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends3.ts(29,30): error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends3.ts(37,31): error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends3.ts(29,30): error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmit_expressionInExtends3.ts (2 errors) ====
|
||||
==== tests/cases/compiler/declarationEmitExpressionInExtends3.ts (2 errors) ====
|
||||
|
||||
export class ExportedClass<T> {
|
||||
x: T;
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_expressionInExtends3.ts]
|
||||
//// [declarationEmitExpressionInExtends3.ts]
|
||||
|
||||
export class ExportedClass<T> {
|
||||
x: T;
|
||||
@@ -43,7 +43,7 @@ export class MyClass4 extends getExportedClass<LocalInterface>(undefined)<Export
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmit_expressionInExtends3.js]
|
||||
//// [declarationEmitExpressionInExtends3.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmit_expressionInExtends4.ts (5 errors) ====
|
||||
==== tests/cases/compiler/declarationEmitExpressionInExtends4.ts (5 errors) ====
|
||||
|
||||
function getSomething() {
|
||||
~~~~~~~~~~~~
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_expressionInExtends4.ts]
|
||||
//// [declarationEmitExpressionInExtends4.ts]
|
||||
|
||||
function getSomething() {
|
||||
return class D { }
|
||||
@@ -17,7 +17,7 @@ class C3 extends SomeUndefinedFunction {
|
||||
|
||||
}
|
||||
|
||||
//// [declarationEmit_expressionInExtends4.js]
|
||||
//// [declarationEmitExpressionInExtends4.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_inferedDefaultExportType.ts]
|
||||
//// [declarationEmitInferedDefaultExportType.ts]
|
||||
|
||||
// test.ts
|
||||
export default {
|
||||
@@ -7,7 +7,7 @@ export default {
|
||||
baz: null
|
||||
}
|
||||
|
||||
//// [declarationEmit_inferedDefaultExportType.js]
|
||||
//// [declarationEmitInferedDefaultExportType.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports["default"] = {
|
||||
@@ -17,7 +17,7 @@ exports["default"] = {
|
||||
};
|
||||
|
||||
|
||||
//// [declarationEmit_inferedDefaultExportType.d.ts]
|
||||
//// [declarationEmitInferedDefaultExportType.d.ts]
|
||||
declare var _default: {
|
||||
foo: any[];
|
||||
bar: any;
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedDefaultExportType.ts ===
|
||||
|
||||
// test.ts
|
||||
export default {
|
||||
foo: [],
|
||||
>foo : Symbol(foo, Decl(declarationEmitInferedDefaultExportType.ts, 2, 16))
|
||||
|
||||
bar: undefined,
|
||||
>bar : Symbol(bar, Decl(declarationEmitInferedDefaultExportType.ts, 3, 10))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
baz: null
|
||||
>baz : Symbol(baz, Decl(declarationEmitInferedDefaultExportType.ts, 4, 17))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_inferedDefaultExportType.ts ===
|
||||
=== tests/cases/compiler/declarationEmitInferedDefaultExportType.ts ===
|
||||
|
||||
// test.ts
|
||||
export default {
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_inferedDefaultExportType2.ts]
|
||||
//// [declarationEmitInferedDefaultExportType2.ts]
|
||||
|
||||
// test.ts
|
||||
export = {
|
||||
@@ -7,7 +7,7 @@ export = {
|
||||
baz: null
|
||||
}
|
||||
|
||||
//// [declarationEmit_inferedDefaultExportType2.js]
|
||||
//// [declarationEmitInferedDefaultExportType2.js]
|
||||
"use strict";
|
||||
module.exports = {
|
||||
foo: [],
|
||||
@@ -16,7 +16,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
|
||||
//// [declarationEmit_inferedDefaultExportType2.d.ts]
|
||||
//// [declarationEmitInferedDefaultExportType2.d.ts]
|
||||
declare var _default: {
|
||||
foo: any[];
|
||||
bar: any;
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedDefaultExportType2.ts ===
|
||||
|
||||
// test.ts
|
||||
export = {
|
||||
foo: [],
|
||||
>foo : Symbol(foo, Decl(declarationEmitInferedDefaultExportType2.ts, 2, 10))
|
||||
|
||||
bar: undefined,
|
||||
>bar : Symbol(bar, Decl(declarationEmitInferedDefaultExportType2.ts, 3, 10))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
baz: null
|
||||
>baz : Symbol(baz, Decl(declarationEmitInferedDefaultExportType2.ts, 4, 17))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_inferedDefaultExportType2.ts ===
|
||||
=== tests/cases/compiler/declarationEmitInferedDefaultExportType2.ts ===
|
||||
|
||||
// test.ts
|
||||
export = {
|
||||
@@ -2,22 +2,22 @@
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Data
|
||||
>Data : string | boolean
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>obj : string | boolean
|
||||
>Data : string | boolean
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Data
|
||||
>"str" || true : Data
|
||||
>v : string | boolean
|
||||
>"str" || true : string | boolean
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
export { v }
|
||||
>v : Data
|
||||
>v : string | boolean
|
||||
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
export { }
|
||||
|
||||
//// [1.ts]
|
||||
var x = "hi" || 5;
|
||||
export default x;
|
||||
let v = "str" || true;
|
||||
function bar () {
|
||||
return v;
|
||||
}
|
||||
export { v, bar }
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
@@ -19,13 +22,17 @@ export default x;
|
||||
}
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var x = "hi" || 5;
|
||||
exports.__esModule = true;
|
||||
exports["default"] = x;
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
function bar() {
|
||||
return v;
|
||||
}
|
||||
exports.bar = bar;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export { };
|
||||
//// [1.d.ts]
|
||||
declare var x: string | number;
|
||||
export default x;
|
||||
declare let v: string | boolean;
|
||||
declare function bar(): string | boolean;
|
||||
export { v, bar };
|
||||
|
||||
@@ -11,9 +11,16 @@
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
var x = "hi" || 5;
|
||||
>x : Symbol(x, Decl(1.ts, 0, 3))
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
|
||||
export default x;
|
||||
>x : Symbol(x, Decl(1.ts, 0, 3))
|
||||
function bar () {
|
||||
>bar : Symbol(bar, Decl(1.ts, 0, 22))
|
||||
|
||||
return v;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
}
|
||||
export { v, bar }
|
||||
>v : Symbol(v, Decl(1.ts, 4, 8))
|
||||
>bar : Symbol(bar, Decl(1.ts, 4, 11))
|
||||
|
||||
|
||||
@@ -2,22 +2,29 @@
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Data
|
||||
>Data : string | boolean
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>obj : string | boolean
|
||||
>Data : string | boolean
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
var x = "hi" || 5;
|
||||
>x : string | number
|
||||
>"hi" || 5 : string | number
|
||||
>"hi" : string
|
||||
>5 : number
|
||||
let v = "str" || true;
|
||||
>v : string | boolean
|
||||
>"str" || true : string | boolean
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
export default x;
|
||||
>x : string | number
|
||||
function bar () {
|
||||
>bar : () => string | boolean
|
||||
|
||||
return v;
|
||||
>v : string | boolean
|
||||
}
|
||||
export { v, bar }
|
||||
>v : string | boolean
|
||||
>bar : () => string | boolean
|
||||
|
||||
|
||||
@@ -9,11 +9,8 @@
|
||||
export { }
|
||||
|
||||
//// [1.ts]
|
||||
let v = "str" || true;
|
||||
function bar () {
|
||||
return v;
|
||||
}
|
||||
export { v, bar }
|
||||
var x = "hi" || 5;
|
||||
export default x;
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
@@ -22,17 +19,13 @@ export { v, bar }
|
||||
}
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
function bar() {
|
||||
return v;
|
||||
}
|
||||
exports.bar = bar;
|
||||
var x = "hi" || 5;
|
||||
exports.__esModule = true;
|
||||
exports["default"] = x;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export { };
|
||||
//// [1.d.ts]
|
||||
declare let v: string | boolean;
|
||||
declare function bar(): string | boolean;
|
||||
export { v, bar };
|
||||
declare var x: string | number;
|
||||
export default x;
|
||||
|
||||
@@ -11,16 +11,9 @@
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
var x = "hi" || 5;
|
||||
>x : Symbol(x, Decl(1.ts, 0, 3))
|
||||
|
||||
function bar () {
|
||||
>bar : Symbol(bar, Decl(1.ts, 0, 22))
|
||||
|
||||
return v;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
}
|
||||
export { v, bar }
|
||||
>v : Symbol(v, Decl(1.ts, 4, 8))
|
||||
>bar : Symbol(bar, Decl(1.ts, 4, 11))
|
||||
export default x;
|
||||
>x : Symbol(x, Decl(1.ts, 0, 3))
|
||||
|
||||
|
||||
@@ -2,29 +2,22 @@
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Data
|
||||
>Data : string | boolean
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>obj : string | boolean
|
||||
>Data : string | boolean
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Data
|
||||
>"str" || true : Data
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
var x = "hi" || 5;
|
||||
>x : string | number
|
||||
>"hi" || 5 : string | number
|
||||
>"hi" : string
|
||||
>5 : number
|
||||
|
||||
function bar () {
|
||||
>bar : () => Data
|
||||
|
||||
return v;
|
||||
>v : Data
|
||||
}
|
||||
export { v, bar }
|
||||
>v : Data
|
||||
>bar : () => Data
|
||||
export default x;
|
||||
>x : string | number
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [declarationEmitInferedTypeAlias4.ts]
|
||||
|
||||
function f<A>() {
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
var x: Foo<A[]>;
|
||||
return x;
|
||||
}
|
||||
|
||||
//// [declarationEmitInferedTypeAlias4.js]
|
||||
function f() {
|
||||
var x;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitInferedTypeAlias4.d.ts]
|
||||
declare function f<A>(): A[] | {
|
||||
x: A[] | any;
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedTypeAlias4.ts ===
|
||||
|
||||
function f<A>() {
|
||||
>f : Symbol(f, Decl(declarationEmitInferedTypeAlias4.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(declarationEmitInferedTypeAlias4.ts, 1, 11))
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias4.ts, 1, 17))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias4.ts, 2, 13))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias4.ts, 2, 13))
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias4.ts, 2, 23))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias4.ts, 1, 17))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias4.ts, 2, 13))
|
||||
|
||||
var x: Foo<A[]>;
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias4.ts, 3, 7))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias4.ts, 1, 17))
|
||||
>A : Symbol(A, Decl(declarationEmitInferedTypeAlias4.ts, 1, 11))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias4.ts, 3, 7))
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedTypeAlias4.ts ===
|
||||
|
||||
function f<A>() {
|
||||
>f : <A>() => A[] | { x: A[] | any; }
|
||||
>A : A
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
>Foo : T | { x: T | any; }
|
||||
>T : T
|
||||
>T : T
|
||||
>x : T | { x: T | any; }
|
||||
>Foo : T | { x: T | any; }
|
||||
>T : T
|
||||
|
||||
var x: Foo<A[]>;
|
||||
>x : A[] | { x: A[] | any; }
|
||||
>Foo : T | { x: T | any; }
|
||||
>A : A
|
||||
|
||||
return x;
|
||||
>x : A[] | { x: A[] | any; }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [tests/cases/compiler/declarationEmitInferedTypeAlias5.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
export type Data = string | boolean;
|
||||
let obj: Data = true;
|
||||
|
||||
//// [1.ts]
|
||||
import * as Z from "./0"
|
||||
//let v2: Z.Data;
|
||||
let v = "str" || true;
|
||||
export { v }
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
var obj = true;
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
//let v2: Z.Data;
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export declare type Data = string | boolean;
|
||||
//// [1.d.ts]
|
||||
import * as Z from "./0";
|
||||
declare let v: Z.Data;
|
||||
export { v };
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
export type Data = string | boolean;
|
||||
>Data : Symbol(Data, Decl(0.ts, 0, 0))
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Symbol(obj, Decl(0.ts, 2, 3))
|
||||
>Data : Symbol(Data, Decl(0.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
import * as Z from "./0"
|
||||
>Z : Symbol(Z, Decl(1.ts, 0, 6))
|
||||
|
||||
//let v2: Z.Data;
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 2, 3))
|
||||
|
||||
export { v }
|
||||
>v : Symbol(v, Decl(1.ts, 3, 8))
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
export type Data = string | boolean;
|
||||
>Data : Data
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>true : true
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
import * as Z from "./0"
|
||||
>Z : typeof Z
|
||||
|
||||
//let v2: Z.Data;
|
||||
let v = "str" || true;
|
||||
>v : Z.Data
|
||||
>"str" || true : Z.Data
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
export { v }
|
||||
>v : Z.Data
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [tests/cases/compiler/declarationEmitInferedTypeAlias6.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
let obj: Data = true;
|
||||
}
|
||||
export { }
|
||||
|
||||
//// [1.ts]
|
||||
let v = "str" || true;
|
||||
export { v }
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
{
|
||||
var obj = true;
|
||||
}
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export { };
|
||||
//// [1.d.ts]
|
||||
declare let v: string | boolean;
|
||||
export { v };
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Symbol(obj, Decl(0.ts, 3, 7))
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
|
||||
export { v }
|
||||
>v : Symbol(v, Decl(1.ts, 1, 8))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : string | boolean
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : string | boolean
|
||||
>Data : string | boolean
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : string | boolean
|
||||
>"str" || true : string | boolean
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
export { v }
|
||||
>v : string | boolean
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [tests/cases/compiler/declarationEmitInferedTypeAlias7.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
export type Data = string | boolean;
|
||||
let obj: Data = true;
|
||||
|
||||
//// [1.ts]
|
||||
let v = "str" || true;
|
||||
export { v }
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
var obj = true;
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export declare type Data = string | boolean;
|
||||
//// [1.d.ts]
|
||||
declare let v: string | boolean;
|
||||
export { v };
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
export type Data = string | boolean;
|
||||
>Data : Symbol(Data, Decl(0.ts, 0, 0))
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Symbol(obj, Decl(0.ts, 2, 3))
|
||||
>Data : Symbol(Data, Decl(0.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
|
||||
export { v }
|
||||
>v : Symbol(v, Decl(1.ts, 1, 8))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
export type Data = string | boolean;
|
||||
>Data : Data
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>true : true
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : string | boolean
|
||||
>"str" || true : string | boolean
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
export { v }
|
||||
>v : string | boolean
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [declarationEmitInferedTypeAlias8.ts]
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
var x: Foo<number[]>;
|
||||
|
||||
function returnSomeGlobalValue() {
|
||||
return x;
|
||||
}
|
||||
|
||||
//// [declarationEmitInferedTypeAlias8.js]
|
||||
var x;
|
||||
function returnSomeGlobalValue() {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitInferedTypeAlias8.d.ts]
|
||||
declare type Foo<T> = T | {
|
||||
x: Foo<T>;
|
||||
};
|
||||
declare var x: Foo<number[]>;
|
||||
declare function returnSomeGlobalValue(): Foo<number[]>;
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedTypeAlias8.ts ===
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias8.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias8.ts, 1, 9))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias8.ts, 1, 9))
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias8.ts, 1, 19))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias8.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias8.ts, 1, 9))
|
||||
|
||||
var x: Foo<number[]>;
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias8.ts, 2, 3))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias8.ts, 0, 0))
|
||||
|
||||
function returnSomeGlobalValue() {
|
||||
>returnSomeGlobalValue : Symbol(returnSomeGlobalValue, Decl(declarationEmitInferedTypeAlias8.ts, 2, 21))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias8.ts, 2, 3))
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedTypeAlias8.ts ===
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
>Foo : Foo<T>
|
||||
>T : T
|
||||
>T : T
|
||||
>x : Foo<T>
|
||||
>Foo : Foo<T>
|
||||
>T : T
|
||||
|
||||
var x: Foo<number[]>;
|
||||
>x : Foo<number[]>
|
||||
>Foo : Foo<T>
|
||||
|
||||
function returnSomeGlobalValue() {
|
||||
>returnSomeGlobalValue : () => Foo<number[]>
|
||||
|
||||
return x;
|
||||
>x : Foo<number[]>
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [declarationEmitInferedTypeAlias9.ts]
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
var x: Foo<number[]>;
|
||||
|
||||
export function returnSomeGlobalValue() {
|
||||
return x;
|
||||
}
|
||||
|
||||
//// [declarationEmitInferedTypeAlias9.js]
|
||||
"use strict";
|
||||
var x;
|
||||
function returnSomeGlobalValue() {
|
||||
return x;
|
||||
}
|
||||
exports.returnSomeGlobalValue = returnSomeGlobalValue;
|
||||
|
||||
|
||||
//// [declarationEmitInferedTypeAlias9.d.ts]
|
||||
export declare function returnSomeGlobalValue(): number[] | {
|
||||
x: number[] | any;
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedTypeAlias9.ts ===
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias9.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias9.ts, 1, 9))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias9.ts, 1, 9))
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias9.ts, 1, 19))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias9.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitInferedTypeAlias9.ts, 1, 9))
|
||||
|
||||
var x: Foo<number[]>;
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias9.ts, 2, 3))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitInferedTypeAlias9.ts, 0, 0))
|
||||
|
||||
export function returnSomeGlobalValue() {
|
||||
>returnSomeGlobalValue : Symbol(returnSomeGlobalValue, Decl(declarationEmitInferedTypeAlias9.ts, 2, 21))
|
||||
|
||||
return x;
|
||||
>x : Symbol(x, Decl(declarationEmitInferedTypeAlias9.ts, 2, 3))
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/declarationEmitInferedTypeAlias9.ts ===
|
||||
|
||||
type Foo<T> = T | { x: Foo<T> };
|
||||
>Foo : T | { x: T | any; }
|
||||
>T : T
|
||||
>T : T
|
||||
>x : T | { x: T | any; }
|
||||
>Foo : T | { x: T | any; }
|
||||
>T : T
|
||||
|
||||
var x: Foo<number[]>;
|
||||
>x : number[] | { x: number[] | any; }
|
||||
>Foo : T | { x: T | any; }
|
||||
|
||||
export function returnSomeGlobalValue() {
|
||||
>returnSomeGlobalValue : () => number[] | { x: number[] | any; }
|
||||
|
||||
return x;
|
||||
>x : number[] | { x: number[] | any; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/compiler/declarationEmitInvalidExport.ts(3,3): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/declarationEmitInvalidExport.ts(5,30): error TS4081: Exported type alias 'MyClass' has or is using private name 'myClass'.
|
||||
tests/cases/compiler/declarationEmitInvalidExport.ts(6,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitInvalidExport.ts (3 errors) ====
|
||||
|
||||
if (false) {
|
||||
export var myClass = 0;
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
export type MyClass = typeof myClass;
|
||||
~~~~~~~
|
||||
!!! error TS4081: Exported type alias 'MyClass' has or is using private name 'myClass'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_invalidExport.ts]
|
||||
//// [declarationEmitInvalidExport.ts]
|
||||
|
||||
if (false) {
|
||||
export var myClass = 0;
|
||||
@@ -7,7 +7,7 @@ export type MyClass = typeof myClass;
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmit_invalidExport.js]
|
||||
//// [declarationEmitInvalidExport.js]
|
||||
"use strict";
|
||||
if (false) {
|
||||
exports.myClass = 0;
|
||||
11
tests/baselines/reference/declarationEmitInvalidReference.js
Normal file
11
tests/baselines/reference/declarationEmitInvalidReference.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [declarationEmitInvalidReference.ts]
|
||||
/// <reference path="invalid.ts" />
|
||||
var x = 0;
|
||||
|
||||
//// [declarationEmitInvalidReference.js]
|
||||
/// <reference path="invalid.ts" />
|
||||
var x = 0;
|
||||
|
||||
|
||||
//// [declarationEmitInvalidReference.d.ts]
|
||||
declare var x: number;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/declarationEmitInvalidReference.ts ===
|
||||
/// <reference path="invalid.ts" />
|
||||
var x = 0;
|
||||
>x : Symbol(x, Decl(declarationEmitInvalidReference.ts, 1, 3))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/declarationEmitInvalidReference.ts ===
|
||||
/// <reference path="invalid.ts" />
|
||||
var x = 0;
|
||||
>x : number
|
||||
>0 : number
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/compiler/declarationEmitInvalidReference2.ts(1,1): error TS6053: File 'tests/cases/compiler/invalid.ts' not found.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitInvalidReference2.ts (1 errors) ====
|
||||
/// <reference path="invalid.ts" />
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS6053: File 'tests/cases/compiler/invalid.ts' not found.
|
||||
var x = 0;
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [declarationEmitInvalidReference2.ts]
|
||||
/// <reference path="invalid.ts" />
|
||||
var x = 0;
|
||||
|
||||
//// [declarationEmitInvalidReference2.js]
|
||||
/// <reference path="invalid.ts" />
|
||||
var x = 0;
|
||||
|
||||
|
||||
//// [declarationEmitInvalidReference2.d.ts]
|
||||
declare var x: number;
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/compiler/declarationEmit_nameConflicts.ts] ////
|
||||
//// [tests/cases/compiler/declarationEmitNameConflicts.ts] ////
|
||||
|
||||
//// [declarationEmit_nameConflicts_1.ts]
|
||||
module f { export class c { } }
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_nameConflicts2.ts]
|
||||
//// [declarationEmitNameConflicts2.ts]
|
||||
module X.Y.base {
|
||||
export function f() { }
|
||||
export class C { }
|
||||
@@ -15,7 +15,7 @@ module X.Y.base.Z {
|
||||
export var E = X.Y.base.E; // Should be base.E
|
||||
}
|
||||
|
||||
//// [declarationEmit_nameConflicts2.js]
|
||||
//// [declarationEmitNameConflicts2.js]
|
||||
var X;
|
||||
(function (X) {
|
||||
var Y;
|
||||
@@ -57,7 +57,7 @@ var X;
|
||||
})(X || (X = {}));
|
||||
|
||||
|
||||
//// [declarationEmit_nameConflicts2.d.ts]
|
||||
//// [declarationEmitNameConflicts2.d.ts]
|
||||
declare module X.Y.base {
|
||||
function f(): void;
|
||||
class C {
|
||||
@@ -0,0 +1,68 @@
|
||||
=== tests/cases/compiler/declarationEmitNameConflicts2.ts ===
|
||||
module X.Y.base {
|
||||
>X : Symbol(X, Decl(declarationEmitNameConflicts2.ts, 0, 0), Decl(declarationEmitNameConflicts2.ts, 7, 1))
|
||||
>Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
|
||||
export function f() { }
|
||||
>f : Symbol(f, Decl(declarationEmitNameConflicts2.ts, 0, 17))
|
||||
|
||||
export class C { }
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts2.ts, 1, 27))
|
||||
|
||||
export module M {
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts2.ts, 2, 22))
|
||||
|
||||
export var v;
|
||||
>v : Symbol(v, Decl(declarationEmitNameConflicts2.ts, 4, 18))
|
||||
}
|
||||
export enum E { }
|
||||
>E : Symbol(E, Decl(declarationEmitNameConflicts2.ts, 5, 5))
|
||||
}
|
||||
|
||||
module X.Y.base.Z {
|
||||
>X : Symbol(X, Decl(declarationEmitNameConflicts2.ts, 0, 0), Decl(declarationEmitNameConflicts2.ts, 7, 1))
|
||||
>Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>Z : Symbol(Z, Decl(declarationEmitNameConflicts2.ts, 9, 16))
|
||||
|
||||
export var f = X.Y.base.f; // Should be base.f
|
||||
>f : Symbol(f, Decl(declarationEmitNameConflicts2.ts, 10, 14))
|
||||
>X.Y.base.f : Symbol(f, Decl(declarationEmitNameConflicts2.ts, 0, 17))
|
||||
>X.Y.base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>X.Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>X : Symbol(X, Decl(declarationEmitNameConflicts2.ts, 0, 0), Decl(declarationEmitNameConflicts2.ts, 7, 1))
|
||||
>Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>f : Symbol(f, Decl(declarationEmitNameConflicts2.ts, 0, 17))
|
||||
|
||||
export var C = X.Y.base.C; // Should be base.C
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts2.ts, 11, 14))
|
||||
>X.Y.base.C : Symbol(C, Decl(declarationEmitNameConflicts2.ts, 1, 27))
|
||||
>X.Y.base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>X.Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>X : Symbol(X, Decl(declarationEmitNameConflicts2.ts, 0, 0), Decl(declarationEmitNameConflicts2.ts, 7, 1))
|
||||
>Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts2.ts, 1, 27))
|
||||
|
||||
export var M = X.Y.base.M; // Should be base.M
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts2.ts, 12, 14))
|
||||
>X.Y.base.M : Symbol(M, Decl(declarationEmitNameConflicts2.ts, 2, 22))
|
||||
>X.Y.base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>X.Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>X : Symbol(X, Decl(declarationEmitNameConflicts2.ts, 0, 0), Decl(declarationEmitNameConflicts2.ts, 7, 1))
|
||||
>Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts2.ts, 2, 22))
|
||||
|
||||
export var E = X.Y.base.E; // Should be base.E
|
||||
>E : Symbol(E, Decl(declarationEmitNameConflicts2.ts, 13, 14))
|
||||
>X.Y.base.E : Symbol(E, Decl(declarationEmitNameConflicts2.ts, 5, 5))
|
||||
>X.Y.base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>X.Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>X : Symbol(X, Decl(declarationEmitNameConflicts2.ts, 0, 0), Decl(declarationEmitNameConflicts2.ts, 7, 1))
|
||||
>Y : Symbol(Y, Decl(declarationEmitNameConflicts2.ts, 0, 9), Decl(declarationEmitNameConflicts2.ts, 9, 9))
|
||||
>base : Symbol(base, Decl(declarationEmitNameConflicts2.ts, 0, 11), Decl(declarationEmitNameConflicts2.ts, 9, 11))
|
||||
>E : Symbol(E, Decl(declarationEmitNameConflicts2.ts, 5, 5))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_nameConflicts2.ts ===
|
||||
=== tests/cases/compiler/declarationEmitNameConflicts2.ts ===
|
||||
module X.Y.base {
|
||||
>X : typeof X
|
||||
>Y : typeof Y
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_nameConflicts3.ts]
|
||||
//// [declarationEmitNameConflicts3.ts]
|
||||
module M {
|
||||
export interface D { }
|
||||
export module D {
|
||||
@@ -26,7 +26,7 @@ module M.P {
|
||||
export var x = M.E.f; // error, should be typeof M.E.f
|
||||
}
|
||||
|
||||
//// [declarationEmit_nameConflicts3.js]
|
||||
//// [declarationEmitNameConflicts3.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -80,7 +80,7 @@ var M;
|
||||
})(M || (M = {}));
|
||||
|
||||
|
||||
//// [declarationEmit_nameConflicts3.d.ts]
|
||||
//// [declarationEmitNameConflicts3.d.ts]
|
||||
declare module M {
|
||||
interface D {
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
=== tests/cases/compiler/declarationEmitNameConflicts3.ts ===
|
||||
module M {
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts3.ts, 0, 0), Decl(declarationEmitNameConflicts3.ts, 11, 1))
|
||||
|
||||
export interface D { }
|
||||
>D : Symbol(D, Decl(declarationEmitNameConflicts3.ts, 0, 10), Decl(declarationEmitNameConflicts3.ts, 1, 26))
|
||||
|
||||
export module D {
|
||||
>D : Symbol(D, Decl(declarationEmitNameConflicts3.ts, 0, 10), Decl(declarationEmitNameConflicts3.ts, 1, 26))
|
||||
|
||||
export function f() { }
|
||||
>f : Symbol(f, Decl(declarationEmitNameConflicts3.ts, 2, 21))
|
||||
}
|
||||
export module C {
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts3.ts, 4, 5))
|
||||
|
||||
export function f() { }
|
||||
>f : Symbol(f, Decl(declarationEmitNameConflicts3.ts, 5, 21))
|
||||
}
|
||||
export module E {
|
||||
>E : Symbol(E, Decl(declarationEmitNameConflicts3.ts, 7, 5))
|
||||
|
||||
export function f() { }
|
||||
>f : Symbol(f, Decl(declarationEmitNameConflicts3.ts, 8, 21))
|
||||
}
|
||||
}
|
||||
|
||||
module M.P {
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts3.ts, 0, 0), Decl(declarationEmitNameConflicts3.ts, 11, 1))
|
||||
>P : Symbol(P, Decl(declarationEmitNameConflicts3.ts, 13, 9))
|
||||
|
||||
export class C {
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts3.ts, 13, 12))
|
||||
|
||||
static f() { }
|
||||
>f : Symbol(C.f, Decl(declarationEmitNameConflicts3.ts, 14, 20))
|
||||
}
|
||||
export class E extends C { }
|
||||
>E : Symbol(E, Decl(declarationEmitNameConflicts3.ts, 16, 5))
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts3.ts, 13, 12))
|
||||
|
||||
export enum D {
|
||||
>D : Symbol(D, Decl(declarationEmitNameConflicts3.ts, 17, 32))
|
||||
|
||||
f
|
||||
>f : Symbol(D.f, Decl(declarationEmitNameConflicts3.ts, 18, 19))
|
||||
}
|
||||
export var v: M.D; // ok
|
||||
>v : Symbol(v, Decl(declarationEmitNameConflicts3.ts, 21, 14))
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts3.ts, 0, 0), Decl(declarationEmitNameConflicts3.ts, 11, 1))
|
||||
>D : Symbol(D, Decl(declarationEmitNameConflicts3.ts, 0, 10), Decl(declarationEmitNameConflicts3.ts, 1, 26))
|
||||
|
||||
export var w = M.D.f; // error, should be typeof M.D.f
|
||||
>w : Symbol(w, Decl(declarationEmitNameConflicts3.ts, 22, 14))
|
||||
>M.D.f : Symbol(M.D.f, Decl(declarationEmitNameConflicts3.ts, 2, 21))
|
||||
>M.D : Symbol(D, Decl(declarationEmitNameConflicts3.ts, 0, 10), Decl(declarationEmitNameConflicts3.ts, 1, 26))
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts3.ts, 0, 0), Decl(declarationEmitNameConflicts3.ts, 11, 1))
|
||||
>D : Symbol(D, Decl(declarationEmitNameConflicts3.ts, 0, 10), Decl(declarationEmitNameConflicts3.ts, 1, 26))
|
||||
>f : Symbol(M.D.f, Decl(declarationEmitNameConflicts3.ts, 2, 21))
|
||||
|
||||
export var x = M.C.f; // error, should be typeof M.C.f
|
||||
>x : Symbol(x, Decl(declarationEmitNameConflicts3.ts, 23, 14), Decl(declarationEmitNameConflicts3.ts, 24, 14))
|
||||
>M.C.f : Symbol(C.f, Decl(declarationEmitNameConflicts3.ts, 5, 21))
|
||||
>M.C : Symbol(C, Decl(declarationEmitNameConflicts3.ts, 4, 5))
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts3.ts, 0, 0), Decl(declarationEmitNameConflicts3.ts, 11, 1))
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflicts3.ts, 4, 5))
|
||||
>f : Symbol(C.f, Decl(declarationEmitNameConflicts3.ts, 5, 21))
|
||||
|
||||
export var x = M.E.f; // error, should be typeof M.E.f
|
||||
>x : Symbol(x, Decl(declarationEmitNameConflicts3.ts, 23, 14), Decl(declarationEmitNameConflicts3.ts, 24, 14))
|
||||
>M.E.f : Symbol(E.f, Decl(declarationEmitNameConflicts3.ts, 8, 21))
|
||||
>M.E : Symbol(E, Decl(declarationEmitNameConflicts3.ts, 7, 5))
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflicts3.ts, 0, 0), Decl(declarationEmitNameConflicts3.ts, 11, 1))
|
||||
>E : Symbol(E, Decl(declarationEmitNameConflicts3.ts, 7, 5))
|
||||
>f : Symbol(E.f, Decl(declarationEmitNameConflicts3.ts, 8, 21))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_nameConflicts3.ts ===
|
||||
=== tests/cases/compiler/declarationEmitNameConflicts3.ts ===
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_nameConflictsWithAlias.ts]
|
||||
//// [declarationEmitNameConflictsWithAlias.ts]
|
||||
export module C { export interface I { } }
|
||||
export import v = C;
|
||||
export module M {
|
||||
@@ -6,14 +6,14 @@ export module M {
|
||||
export var w: v.I; // Gets emitted as C.I, which is the wrong interface
|
||||
}
|
||||
|
||||
//// [declarationEmit_nameConflictsWithAlias.js]
|
||||
//// [declarationEmitNameConflictsWithAlias.js]
|
||||
"use strict";
|
||||
var M;
|
||||
(function (M) {
|
||||
})(M = exports.M || (exports.M = {}));
|
||||
|
||||
|
||||
//// [declarationEmit_nameConflictsWithAlias.d.ts]
|
||||
//// [declarationEmitNameConflictsWithAlias.d.ts]
|
||||
export declare module C {
|
||||
interface I {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/declarationEmitNameConflictsWithAlias.ts ===
|
||||
export module C { export interface I { } }
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflictsWithAlias.ts, 0, 0))
|
||||
>I : Symbol(I, Decl(declarationEmitNameConflictsWithAlias.ts, 0, 17))
|
||||
|
||||
export import v = C;
|
||||
>v : Symbol(v, Decl(declarationEmitNameConflictsWithAlias.ts, 0, 42))
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflictsWithAlias.ts, 0, 0))
|
||||
|
||||
export module M {
|
||||
>M : Symbol(M, Decl(declarationEmitNameConflictsWithAlias.ts, 1, 20))
|
||||
|
||||
export module C { export interface I { } }
|
||||
>C : Symbol(C, Decl(declarationEmitNameConflictsWithAlias.ts, 2, 17))
|
||||
>I : Symbol(I, Decl(declarationEmitNameConflictsWithAlias.ts, 3, 21))
|
||||
|
||||
export var w: v.I; // Gets emitted as C.I, which is the wrong interface
|
||||
>w : Symbol(w, Decl(declarationEmitNameConflictsWithAlias.ts, 4, 14))
|
||||
>v : Symbol(v, Decl(declarationEmitNameConflictsWithAlias.ts, 0, 42))
|
||||
>I : Symbol(v.I, Decl(declarationEmitNameConflictsWithAlias.ts, 0, 17))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_nameConflictsWithAlias.ts ===
|
||||
=== tests/cases/compiler/declarationEmitNameConflictsWithAlias.ts ===
|
||||
export module C { export interface I { } }
|
||||
>C : any
|
||||
>I : I
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [declarationEmit_protectedMembers.ts]
|
||||
//// [declarationEmitProtectedMembers.ts]
|
||||
|
||||
// Class with protected members
|
||||
class C1 {
|
||||
@@ -50,7 +50,7 @@ class C4 {
|
||||
constructor(protected a: number, protected b) { }
|
||||
}
|
||||
|
||||
//// [declarationEmit_protectedMembers.js]
|
||||
//// [declarationEmitProtectedMembers.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@@ -127,7 +127,7 @@ var C4 = (function () {
|
||||
}());
|
||||
|
||||
|
||||
//// [declarationEmit_protectedMembers.d.ts]
|
||||
//// [declarationEmitProtectedMembers.d.ts]
|
||||
declare class C1 {
|
||||
protected x: number;
|
||||
protected f(): number;
|
||||
@@ -0,0 +1,114 @@
|
||||
=== tests/cases/compiler/declarationEmitProtectedMembers.ts ===
|
||||
|
||||
// Class with protected members
|
||||
class C1 {
|
||||
>C1 : Symbol(C1, Decl(declarationEmitProtectedMembers.ts, 0, 0))
|
||||
|
||||
protected x: number;
|
||||
>x : Symbol(C1.x, Decl(declarationEmitProtectedMembers.ts, 2, 10))
|
||||
|
||||
protected f() {
|
||||
>f : Symbol(C1.f, Decl(declarationEmitProtectedMembers.ts, 3, 24))
|
||||
|
||||
return this.x;
|
||||
>this.x : Symbol(C1.x, Decl(declarationEmitProtectedMembers.ts, 2, 10))
|
||||
>this : Symbol(C1, Decl(declarationEmitProtectedMembers.ts, 0, 0))
|
||||
>x : Symbol(C1.x, Decl(declarationEmitProtectedMembers.ts, 2, 10))
|
||||
}
|
||||
|
||||
protected set accessor(a: number) { }
|
||||
>accessor : Symbol(C1.accessor, Decl(declarationEmitProtectedMembers.ts, 7, 5), Decl(declarationEmitProtectedMembers.ts, 9, 41))
|
||||
>a : Symbol(a, Decl(declarationEmitProtectedMembers.ts, 9, 27))
|
||||
|
||||
protected get accessor() { return 0; }
|
||||
>accessor : Symbol(C1.accessor, Decl(declarationEmitProtectedMembers.ts, 7, 5), Decl(declarationEmitProtectedMembers.ts, 9, 41))
|
||||
|
||||
protected static sx: number;
|
||||
>sx : Symbol(C1.sx, Decl(declarationEmitProtectedMembers.ts, 10, 42))
|
||||
|
||||
protected static sf() {
|
||||
>sf : Symbol(C1.sf, Decl(declarationEmitProtectedMembers.ts, 12, 32))
|
||||
|
||||
return this.sx;
|
||||
>this.sx : Symbol(C1.sx, Decl(declarationEmitProtectedMembers.ts, 10, 42))
|
||||
>this : Symbol(C1, Decl(declarationEmitProtectedMembers.ts, 0, 0))
|
||||
>sx : Symbol(C1.sx, Decl(declarationEmitProtectedMembers.ts, 10, 42))
|
||||
}
|
||||
|
||||
protected static set staticSetter(a: number) { }
|
||||
>staticSetter : Symbol(C1.staticSetter, Decl(declarationEmitProtectedMembers.ts, 16, 5))
|
||||
>a : Symbol(a, Decl(declarationEmitProtectedMembers.ts, 18, 38))
|
||||
|
||||
protected static get staticGetter() { return 0; }
|
||||
>staticGetter : Symbol(C1.staticGetter, Decl(declarationEmitProtectedMembers.ts, 18, 52))
|
||||
}
|
||||
|
||||
// Derived class overriding protected members
|
||||
class C2 extends C1 {
|
||||
>C2 : Symbol(C2, Decl(declarationEmitProtectedMembers.ts, 20, 1))
|
||||
>C1 : Symbol(C1, Decl(declarationEmitProtectedMembers.ts, 0, 0))
|
||||
|
||||
protected f() {
|
||||
>f : Symbol(C2.f, Decl(declarationEmitProtectedMembers.ts, 23, 21))
|
||||
|
||||
return super.f() + this.x;
|
||||
>super.f : Symbol(C1.f, Decl(declarationEmitProtectedMembers.ts, 3, 24))
|
||||
>super : Symbol(C1, Decl(declarationEmitProtectedMembers.ts, 0, 0))
|
||||
>f : Symbol(C1.f, Decl(declarationEmitProtectedMembers.ts, 3, 24))
|
||||
>this.x : Symbol(C1.x, Decl(declarationEmitProtectedMembers.ts, 2, 10))
|
||||
>this : Symbol(C2, Decl(declarationEmitProtectedMembers.ts, 20, 1))
|
||||
>x : Symbol(C1.x, Decl(declarationEmitProtectedMembers.ts, 2, 10))
|
||||
}
|
||||
protected static sf() {
|
||||
>sf : Symbol(C2.sf, Decl(declarationEmitProtectedMembers.ts, 26, 5))
|
||||
|
||||
return super.sf() + this.sx;
|
||||
>super.sf : Symbol(C1.sf, Decl(declarationEmitProtectedMembers.ts, 12, 32))
|
||||
>super : Symbol(C1, Decl(declarationEmitProtectedMembers.ts, 0, 0))
|
||||
>sf : Symbol(C1.sf, Decl(declarationEmitProtectedMembers.ts, 12, 32))
|
||||
>this.sx : Symbol(C1.sx, Decl(declarationEmitProtectedMembers.ts, 10, 42))
|
||||
>this : Symbol(C2, Decl(declarationEmitProtectedMembers.ts, 20, 1))
|
||||
>sx : Symbol(C1.sx, Decl(declarationEmitProtectedMembers.ts, 10, 42))
|
||||
}
|
||||
}
|
||||
|
||||
// Derived class making protected members public
|
||||
class C3 extends C2 {
|
||||
>C3 : Symbol(C3, Decl(declarationEmitProtectedMembers.ts, 30, 1))
|
||||
>C2 : Symbol(C2, Decl(declarationEmitProtectedMembers.ts, 20, 1))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(C3.x, Decl(declarationEmitProtectedMembers.ts, 33, 21))
|
||||
|
||||
static sx: number;
|
||||
>sx : Symbol(C3.sx, Decl(declarationEmitProtectedMembers.ts, 34, 14))
|
||||
|
||||
f() {
|
||||
>f : Symbol(C3.f, Decl(declarationEmitProtectedMembers.ts, 35, 22))
|
||||
|
||||
return super.f();
|
||||
>super.f : Symbol(C2.f, Decl(declarationEmitProtectedMembers.ts, 23, 21))
|
||||
>super : Symbol(C2, Decl(declarationEmitProtectedMembers.ts, 20, 1))
|
||||
>f : Symbol(C2.f, Decl(declarationEmitProtectedMembers.ts, 23, 21))
|
||||
}
|
||||
static sf() {
|
||||
>sf : Symbol(C3.sf, Decl(declarationEmitProtectedMembers.ts, 38, 5))
|
||||
|
||||
return super.sf();
|
||||
>super.sf : Symbol(C2.sf, Decl(declarationEmitProtectedMembers.ts, 26, 5))
|
||||
>super : Symbol(C2, Decl(declarationEmitProtectedMembers.ts, 20, 1))
|
||||
>sf : Symbol(C2.sf, Decl(declarationEmitProtectedMembers.ts, 26, 5))
|
||||
}
|
||||
|
||||
static get staticGetter() { return 1; }
|
||||
>staticGetter : Symbol(C3.staticGetter, Decl(declarationEmitProtectedMembers.ts, 41, 5))
|
||||
}
|
||||
|
||||
// Protected properties in constructors
|
||||
class C4 {
|
||||
>C4 : Symbol(C4, Decl(declarationEmitProtectedMembers.ts, 44, 1))
|
||||
|
||||
constructor(protected a: number, protected b) { }
|
||||
>a : Symbol(C4.a, Decl(declarationEmitProtectedMembers.ts, 48, 16))
|
||||
>b : Symbol(C4.b, Decl(declarationEmitProtectedMembers.ts, 48, 36))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/declarationEmit_protectedMembers.ts ===
|
||||
=== tests/cases/compiler/declarationEmitProtectedMembers.ts ===
|
||||
|
||||
// Class with protected members
|
||||
class C1 {
|
||||
@@ -1,10 +1,10 @@
|
||||
//// [declarationEmit_readonly.ts]
|
||||
//// [declarationEmitReadonly.ts]
|
||||
|
||||
class C {
|
||||
constructor(readonly x: number) {}
|
||||
}
|
||||
|
||||
//// [declarationEmit_readonly.js]
|
||||
//// [declarationEmitReadonly.js]
|
||||
var C = (function () {
|
||||
function C(x) {
|
||||
this.x = x;
|
||||
@@ -13,7 +13,7 @@ var C = (function () {
|
||||
}());
|
||||
|
||||
|
||||
//// [declarationEmit_readonly.d.ts]
|
||||
//// [declarationEmitReadonly.d.ts]
|
||||
declare class C {
|
||||
readonly x: number;
|
||||
constructor(x: number);
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmitReadonly.ts ===
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(declarationEmitReadonly.ts, 0, 0))
|
||||
|
||||
constructor(readonly x: number) {}
|
||||
>x : Symbol(C.x, Decl(declarationEmitReadonly.ts, 2, 16))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts ===
|
||||
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmitReadonly.ts ===
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [declarationEmitTypeAliasWithTypeParameters1.ts]
|
||||
|
||||
export type Bar<X, Y> = () => [X, Y];
|
||||
export type Foo<Y> = Bar<any, Y>;
|
||||
export const y = (x: Foo<string>) => 1
|
||||
|
||||
//// [declarationEmitTypeAliasWithTypeParameters1.js]
|
||||
"use strict";
|
||||
exports.y = function (x) { return 1; };
|
||||
|
||||
|
||||
//// [declarationEmitTypeAliasWithTypeParameters1.d.ts]
|
||||
export declare type Bar<X, Y> = () => [X, Y];
|
||||
export declare type Foo<Y> = Bar<any, Y>;
|
||||
export declare const y: (x: () => [any, string]) => number;
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters1.ts ===
|
||||
|
||||
export type Bar<X, Y> = () => [X, Y];
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 0, 0))
|
||||
>X : Symbol(X, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 16))
|
||||
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 18))
|
||||
>X : Symbol(X, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 16))
|
||||
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 18))
|
||||
|
||||
export type Foo<Y> = Bar<any, Y>;
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 37))
|
||||
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 2, 16))
|
||||
>Bar : Symbol(Bar, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 0, 0))
|
||||
>Y : Symbol(Y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 2, 16))
|
||||
|
||||
export const y = (x: Foo<string>) => 1
|
||||
>y : Symbol(y, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 3, 12))
|
||||
>x : Symbol(x, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 3, 18))
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitTypeAliasWithTypeParameters1.ts, 1, 37))
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters1.ts ===
|
||||
|
||||
export type Bar<X, Y> = () => [X, Y];
|
||||
>Bar : Bar<X, Y>
|
||||
>X : X
|
||||
>Y : Y
|
||||
>X : X
|
||||
>Y : Y
|
||||
|
||||
export type Foo<Y> = Bar<any, Y>;
|
||||
>Foo : () => [any, Y]
|
||||
>Y : Y
|
||||
>Bar : Bar<X, Y>
|
||||
>Y : Y
|
||||
|
||||
export const y = (x: Foo<string>) => 1
|
||||
>y : (x: () => [any, string]) => number
|
||||
>(x: Foo<string>) => 1 : (x: () => [any, string]) => number
|
||||
>x : () => [any, string]
|
||||
>Foo : () => [any, Y]
|
||||
>1 : number
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/compiler/declarationEmitUnknownImport.ts(2,14): error TS2304: Cannot find name 'SomeNonExistingName'.
|
||||
tests/cases/compiler/declarationEmitUnknownImport.ts(2,14): error TS2503: Cannot find namespace 'SomeNonExistingName'.
|
||||
tests/cases/compiler/declarationEmitUnknownImport.ts(2,14): error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitUnknownImport.ts (3 errors) ====
|
||||
|
||||
import Foo = SomeNonExistingName
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'SomeNonExistingName'.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'SomeNonExistingName'.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'.
|
||||
export {Foo}
|
||||
@@ -1,9 +1,9 @@
|
||||
//// [declarationEmit_UnknownImport.ts]
|
||||
//// [declarationEmitUnknownImport.ts]
|
||||
|
||||
import Foo = SomeNonExistingName
|
||||
export {Foo}
|
||||
|
||||
//// [declarationEmit_UnknownImport.js]
|
||||
//// [declarationEmitUnknownImport.js]
|
||||
"use strict";
|
||||
var Foo = SomeNonExistingName;
|
||||
exports.Foo = Foo;
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/declarationEmitUnknownImport2.ts(2,12): error TS1005: '=' expected.
|
||||
tests/cases/compiler/declarationEmitUnknownImport2.ts(2,12): error TS2304: Cannot find name 'From'.
|
||||
tests/cases/compiler/declarationEmitUnknownImport2.ts(2,12): error TS2503: Cannot find namespace 'From'.
|
||||
tests/cases/compiler/declarationEmitUnknownImport2.ts(2,12): error TS4000: Import declaration 'Foo' is using private name 'From'.
|
||||
tests/cases/compiler/declarationEmitUnknownImport2.ts(2,17): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitUnknownImport2.ts (5 errors) ====
|
||||
|
||||
import Foo From './Foo'; // Syntax error
|
||||
~~~~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'From'.
|
||||
~~~~
|
||||
!!! error TS2503: Cannot find namespace 'From'.
|
||||
~~~~
|
||||
!!! error TS4000: Import declaration 'Foo' is using private name 'From'.
|
||||
~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
export default Foo
|
||||
@@ -1,9 +1,9 @@
|
||||
//// [declarationEmit_UnknownImport2.ts]
|
||||
//// [declarationEmitUnknownImport2.ts]
|
||||
|
||||
import Foo From './Foo'; // Syntax error
|
||||
export default Foo
|
||||
|
||||
//// [declarationEmit_UnknownImport2.js]
|
||||
//// [declarationEmitUnknownImport2.js]
|
||||
"use strict";
|
||||
var Foo = From;
|
||||
'./Foo'; // Syntax error
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS2304: Cannot find name 'SomeNonExistingName'.
|
||||
tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS2503: Cannot find namespace 'SomeNonExistingName'.
|
||||
tests/cases/compiler/declarationEmit_UnknownImport.ts(2,14): error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmit_UnknownImport.ts (3 errors) ====
|
||||
|
||||
import Foo = SomeNonExistingName
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'SomeNonExistingName'.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2503: Cannot find namespace 'SomeNonExistingName'.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'.
|
||||
export {Foo}
|
||||
@@ -1,21 +0,0 @@
|
||||
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS1005: '=' expected.
|
||||
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS2304: Cannot find name 'From'.
|
||||
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS2503: Cannot find namespace 'From'.
|
||||
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,12): error TS4000: Import declaration 'Foo' is using private name 'From'.
|
||||
tests/cases/compiler/declarationEmit_UnknownImport2.ts(2,17): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmit_UnknownImport2.ts (5 errors) ====
|
||||
|
||||
import Foo From './Foo'; // Syntax error
|
||||
~~~~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'From'.
|
||||
~~~~
|
||||
!!! error TS2503: Cannot find namespace 'From'.
|
||||
~~~~
|
||||
!!! error TS4000: Import declaration 'Foo' is using private name 'From'.
|
||||
~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
export default Foo
|
||||
@@ -1,10 +0,0 @@
|
||||
//// [declarationEmit_array-types-from-generic-array-usage.ts]
|
||||
interface A extends Array<string> { }
|
||||
|
||||
|
||||
//// [declarationEmit_array-types-from-generic-array-usage.js]
|
||||
|
||||
|
||||
//// [declarationEmit_array-types-from-generic-array-usage.d.ts]
|
||||
interface A extends Array<string> {
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmit_array-types-from-generic-array-usage.ts ===
|
||||
interface A extends Array<string> { }
|
||||
>A : Symbol(A, Decl(declarationEmit_array-types-from-generic-array-usage.ts, 0, 0))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
=== tests/cases/compiler/declarationEmit_array-types-from-generic-array-usage.ts ===
|
||||
interface A extends Array<string> { }
|
||||
>A : A
|
||||
>Array : T[]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user