Merge pull request #6863 from plantain-00/i6844

fix error message with public class inside namespace
This commit is contained in:
Mohamed Hegazy 2016-02-02 18:33:24 -08:00
commit 33ef358893
9 changed files with 71 additions and 71 deletions

View file

@ -16214,7 +16214,7 @@ namespace ts {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, text);
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & NodeFlags.Abstract) {
if (modifier.kind === SyntaxKind.PrivateKeyword) {
@ -16238,7 +16238,7 @@ namespace ts {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static");
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
else if (node.kind === SyntaxKind.Parameter) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");

View file

@ -123,7 +123,7 @@
"category": "Error",
"code": 1043
},
"'{0}' modifier cannot appear on a module element.": {
"'{0}' modifier cannot appear on a module or namespace element.": {
"category": "Error",
"code": 1044
},

View file

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element.
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (1 errors) ====
protected class C {
~~~~~~~~~
!!! error TS1044: 'protected' modifier cannot appear on a module element.
!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element.
}

View file

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element.
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (1 errors) ====
protected module M {
~~~~~~~~~
!!! error TS1044: 'protected' modifier cannot appear on a module element.
!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element.
}

View file

@ -1,8 +1,8 @@
tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/compiler/importDeclWithClassModifiers.ts(5,28): error TS2305: Module 'x' has no exported member 'c'.
tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/compiler/importDeclWithClassModifiers.ts(6,29): error TS2305: Module 'x' has no exported member 'c'.
tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2305: Module 'x' has no exported member 'c'.
@ -13,17 +13,17 @@ tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2305: Module
}
export public import a = x.c;
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
~
!!! error TS2305: Module 'x' has no exported member 'c'.
export private import b = x.c;
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
~
!!! error TS2305: Module 'x' has no exported member 'c'.
export static import c = x.c;
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
~
!!! error TS2305: Module 'x' has no exported member 'c'.
var b: a;

View file

@ -1,24 +1,24 @@
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts (21 errors) ====
@ -27,11 +27,11 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module Y {
public class A { s: string }
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
public class BB<T> extends A {
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
id: number;
}
}
@ -39,20 +39,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module Y2 {
public class AA<T> { s: T }
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
public interface I { id: number }
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
public class B extends AA<string> implements I { id: number }
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
}
module Y3 {
public module Module {
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
class A { s: string }
}
}
@ -60,17 +60,17 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module Y4 {
public enum Color { Blue, Red }
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
}
module YY {
private class A { s: string }
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
private class BB<T> extends A {
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
id: number;
}
}
@ -78,20 +78,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module YY2 {
private class AA<T> { s: T }
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
private interface I { id: number }
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
private class B extends AA<string> implements I { id: number }
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
}
module YY3 {
private module Module {
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
class A { s: string }
}
}
@ -99,18 +99,18 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module YY4 {
private enum Color { Blue, Red }
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
}
module YYY {
static class A { s: string }
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
static class BB<T> extends A {
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
id: number;
}
}
@ -118,20 +118,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module YYY2 {
static class AA<T> { s: T }
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
static interface I { id: number }
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
static class B extends AA<string> implements I { id: number }
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
}
module YYY3 {
static module Module {
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
class A { s: string }
}
}
@ -139,6 +139,6 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf
module YYY4 {
static enum Color { Blue, Red }
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
}

View file

@ -1,9 +1,9 @@
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts (6 errors) ====
@ -12,37 +12,37 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatement
module Y {
public var x: number = 0;
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
}
module Y2 {
public function fn(x: string) { }
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
}
module Y4 {
static var x: number = 0;
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
}
module YY {
static function fn(x: string) { }
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
}
module YY2 {
private var x: number = 0;
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
}
module YY3 {
private function fn(x: string) { }
~~~~~~~
!!! error TS1044: 'private' modifier cannot appear on a module element.
!!! error TS1044: 'private' modifier cannot appear on a module or namespace element.
}

View file

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts(1,1): error TS1044: 'public' modifier cannot appear on a module element.
tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts(1,1): error TS1044: 'public' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts (1 errors) ====
public interface I {
~~~~~~
!!! error TS1044: 'public' modifier cannot appear on a module element.
!!! error TS1044: 'public' modifier cannot appear on a module or namespace element.
}

View file

@ -1,8 +1,8 @@
tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts(1,1): error TS1044: 'static' modifier cannot appear on a module element.
tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts(1,1): error TS1044: 'static' modifier cannot appear on a module or namespace element.
==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts (1 errors) ====
static interface I {
~~~~~~
!!! error TS1044: 'static' modifier cannot appear on a module element.
!!! error TS1044: 'static' modifier cannot appear on a module or namespace element.
}