Fix undefined symbol name in error message

This commit is contained in:
Mohamed Hegazy 2014-08-26 13:03:24 -07:00
parent 062823c3d5
commit 211008d015
4 changed files with 41 additions and 0 deletions

View File

@ -2236,6 +2236,7 @@ module ts {
return emptyObjectType;
}
var type = getDeclaredTypeOfSymbol(symbol);
var name = symbol.name;
if (!(type.flags & TypeFlags.ObjectType)) {
error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, name);
return emptyObjectType;

View File

@ -0,0 +1,15 @@
!!! Cannot find global type 'Boolean'.
!!! Cannot find global type 'IArguments'.
==== tests/cases/compiler/noDefaultLib.ts (1 errors) ====
/// <reference no-default-lib="true"/>
var x;
interface Array {}
~~~~~
!!! Global type 'Array' must have 1 type parameter(s).
interface String {}
interface Number {}
interface Object {}
interface Date {}
interface Function {}
interface RegExp {}

View File

@ -0,0 +1,15 @@
//// [noDefaultLib.ts]
/// <reference no-default-lib="true"/>
var x;
interface Array {}
interface String {}
interface Number {}
interface Object {}
interface Date {}
interface Function {}
interface RegExp {}
//// [noDefaultLib.js]
/// <reference no-default-lib="true"/>
var x;

View File

@ -0,0 +1,10 @@
/// <reference no-default-lib="true"/>
var x;
interface Array {}
interface String {}
interface Number {}
interface Object {}
interface Date {}
interface Function {}
interface RegExp {}