Merge pull request #4502 from Microsoft/fixClassExtendsNullDeclEmit

Fixes declaration emit for a class that extends null
This commit is contained in:
Ron Buckton
2015-08-27 13:58:54 -07:00
5 changed files with 42 additions and 0 deletions

View File

@@ -896,6 +896,9 @@ namespace ts {
if (isSupportedExpressionWithTypeArguments(node)) {
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
}
else if (!isImplementsList && node.expression.kind === SyntaxKind.NullKeyword) {
write("null");
}
function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
let diagnosticMessage: DiagnosticMessage;

View File

@@ -0,0 +1,23 @@
//// [declFileClassExtendsNull.ts]
class ExtendsNull extends null {
}
//// [declFileClassExtendsNull.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; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var ExtendsNull = (function (_super) {
__extends(ExtendsNull, _super);
function ExtendsNull() {
_super.apply(this, arguments);
}
return ExtendsNull;
})(null);
//// [declFileClassExtendsNull.d.ts]
declare class ExtendsNull extends null {
}

View File

@@ -0,0 +1,5 @@
=== tests/cases/compiler/declFileClassExtendsNull.ts ===
class ExtendsNull extends null {
>ExtendsNull : Symbol(ExtendsNull, Decl(declFileClassExtendsNull.ts, 0, 0))
}

View File

@@ -0,0 +1,6 @@
=== tests/cases/compiler/declFileClassExtendsNull.ts ===
class ExtendsNull extends null {
>ExtendsNull : ExtendsNull
>null : null
}

View File

@@ -0,0 +1,5 @@
// @target: ES5
// @declaration: true
class ExtendsNull extends null {
}