Additional tests

This commit is contained in:
Ron Buckton
2017-10-04 19:41:48 -07:00
parent ee23f93275
commit 51ded0be7f
5 changed files with 206 additions and 194 deletions

View File

@@ -1,66 +1,70 @@
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(2,19): error TS1337: 'unique symbol' types may not be used on a variable declaration with a binding name.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(3,13): error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(2,41): error TS1005: 'symbol' expected.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(3,19): error TS1337: 'unique symbol' types may not be used on a variable declaration with a binding name.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(4,13): error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(7,38): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(8,45): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(9,39): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(10,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(11,53): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(12,59): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(13,50): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(17,44): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(19,14): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(20,5): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(21,25): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(22,33): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(23,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(24,27): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(25,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(26,46): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(27,37): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(28,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(29,28): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(31,12): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(32,38): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(33,46): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(34,39): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(35,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(36,53): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(37,59): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(38,50): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(39,39): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(40,41): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(45,5): error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(46,25): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(47,33): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(48,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(49,27): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(50,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(51,46): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(52,37): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(57,5): error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(58,25): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(59,33): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(60,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(61,27): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(62,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(63,46): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(64,37): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(68,21): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(69,52): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(70,49): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(73,44): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(74,33): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(75,34): error TS1332: 'unique symbol' types are not allowed in a tuple type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(78,51): error TS1333: 'unique symbol' types are not allowed in a mapped type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(81,29): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(81,45): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,36): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(5,13): error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(8,38): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(9,46): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(10,39): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(11,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(12,53): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(13,59): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(14,50): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(18,44): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(20,14): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(21,5): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(22,25): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(23,34): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(24,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(25,27): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(26,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(27,46): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(28,37): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(29,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(30,28): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(32,12): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(33,38): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(34,47): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(35,39): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(36,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(37,53): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(38,59): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(39,50): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(40,39): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(41,41): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(46,5): error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(47,25): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(48,34): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(49,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(50,27): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(51,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(52,46): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(53,37): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(58,5): error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(59,25): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(60,34): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(61,26): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(62,27): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(63,40): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(64,46): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(65,37): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(69,21): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(70,52): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(71,49): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(74,44): error TS1339: 'unique symbol' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(75,34): error TS1331: 'unique symbol' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(76,34): error TS1332: 'unique symbol' types are not allowed in a tuple type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(79,51): error TS1333: 'unique symbol' types are not allowed in a mapped type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,29): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,45): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,36): error TS1329: 'unique symbol' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,52): error TS1329: 'unique symbol' types are not allowed in a union type.
==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts (59 errors) ====
==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts (60 errors) ====
// declarations
declare const invalidUniqueType: unique number;
~~~~~~
!!! error TS1005: 'symbol' expected.
declare const {}: unique symbol;
~~~~~~~~~~~~~
!!! error TS1337: 'unique symbol' types may not be used on a variable declaration with a binding name.
@@ -75,8 +79,8 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error
declare function invalidArgType(arg: unique symbol): void;
~~~~~~~~~~~~~
!!! error TS1339: 'unique symbol' types are not allowed here.
declare function invalidRestArgType(...arg: unique symbol[]): void;
~~~~~~~~~~~~~
declare function invalidRestArgType(...arg: (unique symbol)[]): void;
~~~~~~~~~~~~~
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
declare function invalidReturnType(): unique symbol;
~~~~~~~~~~~~~
@@ -109,8 +113,8 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error
invalidArgType(arg: unique symbol): void { return; }
~~~~~~~~~~~~~
!!! error TS1339: 'unique symbol' types are not allowed here.
invalidRestArgType(...args: unique symbol[]): void { return; }
~~~~~~~~~~~~~
invalidRestArgType(...args: (unique symbol)[]): void { return; }
~~~~~~~~~~~~~
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
invalidReturnType(): unique symbol { return; }
~~~~~~~~~~~~~
@@ -140,8 +144,8 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error
static invalidStaticArgType(arg: unique symbol): void { return; }
~~~~~~~~~~~~~
!!! error TS1339: 'unique symbol' types are not allowed here.
static invalidStaticRestArgType(...args: unique symbol[]): void { return; }
~~~~~~~~~~~~~
static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; }
~~~~~~~~~~~~~
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
static invalidStaticReturnType(): unique symbol { return; }
~~~~~~~~~~~~~
@@ -174,8 +178,8 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error
invalidArgType(arg: unique symbol): void;
~~~~~~~~~~~~~
!!! error TS1339: 'unique symbol' types are not allowed here.
invalidRestArgType(...args: unique symbol[]): void;
~~~~~~~~~~~~~
invalidRestArgType(...args: (unique symbol)[]): void;
~~~~~~~~~~~~~
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
invalidReturnType(): unique symbol;
~~~~~~~~~~~~~
@@ -202,8 +206,8 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error
invalidArgType(arg: unique symbol): void;
~~~~~~~~~~~~~
!!! error TS1339: 'unique symbol' types are not allowed here.
invalidRestArgType(...args: unique symbol[]): void;
~~~~~~~~~~~~~
invalidRestArgType(...args: (unique symbol)[]): void;
~~~~~~~~~~~~~
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
invalidReturnType(): unique symbol;
~~~~~~~~~~~~~
@@ -237,8 +241,8 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,52): error
declare const invalidTypeArgument: Promise<unique symbol>;
~~~~~~~~~~~~~
!!! error TS1339: 'unique symbol' types are not allowed here.
declare const invalidArrayType: unique symbol[];
~~~~~~~~~~~~~
declare const invalidArrayType: (unique symbol)[];
~~~~~~~~~~~~~
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
declare const invalidTupleType: [unique symbol];
~~~~~~~~~~~~~

View File

@@ -1,12 +1,13 @@
//// [uniqueSymbolsErrors.ts]
// declarations
declare const invalidUniqueType: unique number;
declare const {}: unique symbol;
declare let invalidLetType: unique symbol;
declare var invalidVarType: unique symbol;
// function arguments and return types
declare function invalidArgType(arg: unique symbol): void;
declare function invalidRestArgType(...arg: unique symbol[]): void;
declare function invalidRestArgType(...arg: (unique symbol)[]): void;
declare function invalidReturnType(): unique symbol;
declare function invalidThisType(this: unique symbol): void;
declare function invalidTypePredicate(n: any): n is unique symbol;
@@ -20,7 +21,7 @@ class InvalidClass {
readonly invalidReadonlyPropertyType: unique symbol;
invalidPropertyType: unique symbol;
invalidArgType(arg: unique symbol): void { return; }
invalidRestArgType(...args: unique symbol[]): void { return; }
invalidRestArgType(...args: (unique symbol)[]): void { return; }
invalidReturnType(): unique symbol { return; }
invalidThisType(this: unique symbol): void { return; }
invalidTypePredicate(n: any): n is unique symbol { return; }
@@ -31,7 +32,7 @@ class InvalidClass {
static invalidStaticPropertyType: unique symbol;
static invalidStaticArgType(arg: unique symbol): void { return; }
static invalidStaticRestArgType(...args: unique symbol[]): void { return; }
static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; }
static invalidStaticReturnType(): unique symbol { return; }
static invalidStaticThisType(this: unique symbol): void { return; }
static invalidStaticTypePredicate(n: any): n is unique symbol { return; }
@@ -45,7 +46,7 @@ class InvalidClass {
interface InvalidInterface {
invalidPropertyType: unique symbol;
invalidArgType(arg: unique symbol): void;
invalidRestArgType(...args: unique symbol[]): void;
invalidRestArgType(...args: (unique symbol)[]): void;
invalidReturnType(): unique symbol;
invalidThisType(this: unique symbol);
invalidTypePredicate(n: any): n is unique symbol
@@ -57,7 +58,7 @@ interface InvalidInterface {
type InvalidTypeLiteral = {
invalidPropertyType: unique symbol;
invalidArgType(arg: unique symbol): void;
invalidRestArgType(...args: unique symbol[]): void;
invalidRestArgType(...args: (unique symbol)[]): void;
invalidReturnType(): unique symbol;
invalidThisType(this: unique symbol);
invalidTypePredicate(n: any): n is unique symbol
@@ -72,7 +73,7 @@ type InvalidAliasTypeParameterDefault<T extends unique symbol> = never;
// type references
declare const invalidTypeArgument: Promise<unique symbol>;
declare const invalidArrayType: unique symbol[];
declare const invalidArrayType: (unique symbol)[];
declare const invalidTupleType: [unique symbol];
// mapped types

View File

@@ -1,235 +1,238 @@
=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts ===
// declarations
declare const invalidUniqueType: unique number;
>invalidUniqueType : Symbol(invalidUniqueType, Decl(uniqueSymbolsErrors.ts, 1, 13))
declare const {}: unique symbol;
declare let invalidLetType: unique symbol;
>invalidLetType : Symbol(invalidLetType, Decl(uniqueSymbolsErrors.ts, 2, 11))
>invalidLetType : Symbol(invalidLetType, Decl(uniqueSymbolsErrors.ts, 3, 11))
declare var invalidVarType: unique symbol;
>invalidVarType : Symbol(invalidVarType, Decl(uniqueSymbolsErrors.ts, 3, 11))
>invalidVarType : Symbol(invalidVarType, Decl(uniqueSymbolsErrors.ts, 4, 11))
// function arguments and return types
declare function invalidArgType(arg: unique symbol): void;
>invalidArgType : Symbol(invalidArgType, Decl(uniqueSymbolsErrors.ts, 3, 42))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 6, 32))
>invalidArgType : Symbol(invalidArgType, Decl(uniqueSymbolsErrors.ts, 4, 42))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 7, 32))
declare function invalidRestArgType(...arg: unique symbol[]): void;
>invalidRestArgType : Symbol(invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 6, 58))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 7, 36))
declare function invalidRestArgType(...arg: (unique symbol)[]): void;
>invalidRestArgType : Symbol(invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 7, 58))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 8, 36))
declare function invalidReturnType(): unique symbol;
>invalidReturnType : Symbol(invalidReturnType, Decl(uniqueSymbolsErrors.ts, 7, 67))
>invalidReturnType : Symbol(invalidReturnType, Decl(uniqueSymbolsErrors.ts, 8, 69))
declare function invalidThisType(this: unique symbol): void;
>invalidThisType : Symbol(invalidThisType, Decl(uniqueSymbolsErrors.ts, 8, 52))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 9, 33))
>invalidThisType : Symbol(invalidThisType, Decl(uniqueSymbolsErrors.ts, 9, 52))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 10, 33))
declare function invalidTypePredicate(n: any): n is unique symbol;
>invalidTypePredicate : Symbol(invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 9, 60))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 10, 38))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 10, 38))
>invalidTypePredicate : Symbol(invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 10, 60))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 11, 38))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 11, 38))
declare function invalidTypeParameterConstraint<T extends unique symbol>(): void;
>invalidTypeParameterConstraint : Symbol(invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 10, 66))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 11, 48))
>invalidTypeParameterConstraint : Symbol(invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 11, 66))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 12, 48))
declare function invalidTypeParameterDefault<T = unique symbol>(): void;
>invalidTypeParameterDefault : Symbol(invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 11, 81))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 12, 45))
>invalidTypeParameterDefault : Symbol(invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 12, 81))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 13, 45))
// classes
class InvalidClass {
>InvalidClass : Symbol(InvalidClass, Decl(uniqueSymbolsErrors.ts, 12, 72))
>InvalidClass : Symbol(InvalidClass, Decl(uniqueSymbolsErrors.ts, 13, 72))
constructor(invalidConstructorArgType: unique symbol) {}
>invalidConstructorArgType : Symbol(invalidConstructorArgType, Decl(uniqueSymbolsErrors.ts, 16, 16))
>invalidConstructorArgType : Symbol(invalidConstructorArgType, Decl(uniqueSymbolsErrors.ts, 17, 16))
readonly invalidReadonlyPropertyType: unique symbol;
>invalidReadonlyPropertyType : Symbol(InvalidClass.invalidReadonlyPropertyType, Decl(uniqueSymbolsErrors.ts, 16, 60))
>invalidReadonlyPropertyType : Symbol(InvalidClass.invalidReadonlyPropertyType, Decl(uniqueSymbolsErrors.ts, 17, 60))
invalidPropertyType: unique symbol;
>invalidPropertyType : Symbol(InvalidClass.invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 18, 56))
>invalidPropertyType : Symbol(InvalidClass.invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 19, 56))
invalidArgType(arg: unique symbol): void { return; }
>invalidArgType : Symbol(InvalidClass.invalidArgType, Decl(uniqueSymbolsErrors.ts, 19, 39))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 20, 19))
>invalidArgType : Symbol(InvalidClass.invalidArgType, Decl(uniqueSymbolsErrors.ts, 20, 39))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 21, 19))
invalidRestArgType(...args: unique symbol[]): void { return; }
>invalidRestArgType : Symbol(InvalidClass.invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 20, 56))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 21, 23))
invalidRestArgType(...args: (unique symbol)[]): void { return; }
>invalidRestArgType : Symbol(InvalidClass.invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 21, 56))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 22, 23))
invalidReturnType(): unique symbol { return; }
>invalidReturnType : Symbol(InvalidClass.invalidReturnType, Decl(uniqueSymbolsErrors.ts, 21, 66))
>invalidReturnType : Symbol(InvalidClass.invalidReturnType, Decl(uniqueSymbolsErrors.ts, 22, 68))
invalidThisType(this: unique symbol): void { return; }
>invalidThisType : Symbol(InvalidClass.invalidThisType, Decl(uniqueSymbolsErrors.ts, 22, 50))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 23, 20))
>invalidThisType : Symbol(InvalidClass.invalidThisType, Decl(uniqueSymbolsErrors.ts, 23, 50))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 24, 20))
invalidTypePredicate(n: any): n is unique symbol { return; }
>invalidTypePredicate : Symbol(InvalidClass.invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 23, 58))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 24, 25))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 24, 25))
>invalidTypePredicate : Symbol(InvalidClass.invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 24, 58))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 25, 25))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 25, 25))
invalidTypeParameterConstraint<T extends unique symbol>(): void { return; }
>invalidTypeParameterConstraint : Symbol(InvalidClass.invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 24, 64))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 25, 35))
>invalidTypeParameterConstraint : Symbol(InvalidClass.invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 25, 64))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 26, 35))
invalidTypeParameterDefault<T = unique symbol>(): void { return; }
>invalidTypeParameterDefault : Symbol(InvalidClass.invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 25, 79))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 26, 32))
>invalidTypeParameterDefault : Symbol(InvalidClass.invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 26, 79))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 27, 32))
get invalidGetter(): unique symbol { return; }
>invalidGetter : Symbol(InvalidClass.invalidGetter, Decl(uniqueSymbolsErrors.ts, 26, 70))
>invalidGetter : Symbol(InvalidClass.invalidGetter, Decl(uniqueSymbolsErrors.ts, 27, 70))
set invalidSetter(arg: unique symbol) { return; }
>invalidSetter : Symbol(InvalidClass.invalidSetter, Decl(uniqueSymbolsErrors.ts, 27, 50))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 28, 22))
>invalidSetter : Symbol(InvalidClass.invalidSetter, Decl(uniqueSymbolsErrors.ts, 28, 50))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 29, 22))
static invalidStaticPropertyType: unique symbol;
>invalidStaticPropertyType : Symbol(InvalidClass.invalidStaticPropertyType, Decl(uniqueSymbolsErrors.ts, 28, 53))
>invalidStaticPropertyType : Symbol(InvalidClass.invalidStaticPropertyType, Decl(uniqueSymbolsErrors.ts, 29, 53))
static invalidStaticArgType(arg: unique symbol): void { return; }
>invalidStaticArgType : Symbol(InvalidClass.invalidStaticArgType, Decl(uniqueSymbolsErrors.ts, 30, 52))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 31, 32))
>invalidStaticArgType : Symbol(InvalidClass.invalidStaticArgType, Decl(uniqueSymbolsErrors.ts, 31, 52))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 32, 32))
static invalidStaticRestArgType(...args: unique symbol[]): void { return; }
>invalidStaticRestArgType : Symbol(InvalidClass.invalidStaticRestArgType, Decl(uniqueSymbolsErrors.ts, 31, 69))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 32, 36))
static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; }
>invalidStaticRestArgType : Symbol(InvalidClass.invalidStaticRestArgType, Decl(uniqueSymbolsErrors.ts, 32, 69))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 33, 36))
static invalidStaticReturnType(): unique symbol { return; }
>invalidStaticReturnType : Symbol(InvalidClass.invalidStaticReturnType, Decl(uniqueSymbolsErrors.ts, 32, 79))
>invalidStaticReturnType : Symbol(InvalidClass.invalidStaticReturnType, Decl(uniqueSymbolsErrors.ts, 33, 81))
static invalidStaticThisType(this: unique symbol): void { return; }
>invalidStaticThisType : Symbol(InvalidClass.invalidStaticThisType, Decl(uniqueSymbolsErrors.ts, 33, 63))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 34, 33))
>invalidStaticThisType : Symbol(InvalidClass.invalidStaticThisType, Decl(uniqueSymbolsErrors.ts, 34, 63))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 35, 33))
static invalidStaticTypePredicate(n: any): n is unique symbol { return; }
>invalidStaticTypePredicate : Symbol(InvalidClass.invalidStaticTypePredicate, Decl(uniqueSymbolsErrors.ts, 34, 71))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 35, 38))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 35, 38))
>invalidStaticTypePredicate : Symbol(InvalidClass.invalidStaticTypePredicate, Decl(uniqueSymbolsErrors.ts, 35, 71))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 36, 38))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 36, 38))
static invalidStaticTypeParameterConstraint<T extends unique symbol>(): void { return; }
>invalidStaticTypeParameterConstraint : Symbol(InvalidClass.invalidStaticTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 35, 77))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 36, 48))
>invalidStaticTypeParameterConstraint : Symbol(InvalidClass.invalidStaticTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 36, 77))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 37, 48))
static invalidStaticTypeParameterDefault<T = unique symbol>(): void { return; }
>invalidStaticTypeParameterDefault : Symbol(InvalidClass.invalidStaticTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 36, 92))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 37, 45))
>invalidStaticTypeParameterDefault : Symbol(InvalidClass.invalidStaticTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 37, 92))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 38, 45))
static get invalidStaticGetter(): unique symbol { return; }
>invalidStaticGetter : Symbol(InvalidClass.invalidStaticGetter, Decl(uniqueSymbolsErrors.ts, 37, 83))
>invalidStaticGetter : Symbol(InvalidClass.invalidStaticGetter, Decl(uniqueSymbolsErrors.ts, 38, 83))
static set invalidStaticSetter(arg: unique symbol) { return; }
>invalidStaticSetter : Symbol(InvalidClass.invalidStaticSetter, Decl(uniqueSymbolsErrors.ts, 38, 63))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 39, 35))
>invalidStaticSetter : Symbol(InvalidClass.invalidStaticSetter, Decl(uniqueSymbolsErrors.ts, 39, 63))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 40, 35))
}
// interfaces
interface InvalidInterface {
>InvalidInterface : Symbol(InvalidInterface, Decl(uniqueSymbolsErrors.ts, 40, 1))
>InvalidInterface : Symbol(InvalidInterface, Decl(uniqueSymbolsErrors.ts, 41, 1))
invalidPropertyType: unique symbol;
>invalidPropertyType : Symbol(InvalidInterface.invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 43, 28))
>invalidPropertyType : Symbol(InvalidInterface.invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 44, 28))
invalidArgType(arg: unique symbol): void;
>invalidArgType : Symbol(InvalidInterface.invalidArgType, Decl(uniqueSymbolsErrors.ts, 44, 39))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 45, 19))
>invalidArgType : Symbol(InvalidInterface.invalidArgType, Decl(uniqueSymbolsErrors.ts, 45, 39))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 46, 19))
invalidRestArgType(...args: unique symbol[]): void;
>invalidRestArgType : Symbol(InvalidInterface.invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 45, 45))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 46, 23))
invalidRestArgType(...args: (unique symbol)[]): void;
>invalidRestArgType : Symbol(InvalidInterface.invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 46, 45))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 47, 23))
invalidReturnType(): unique symbol;
>invalidReturnType : Symbol(InvalidInterface.invalidReturnType, Decl(uniqueSymbolsErrors.ts, 46, 55))
>invalidReturnType : Symbol(InvalidInterface.invalidReturnType, Decl(uniqueSymbolsErrors.ts, 47, 57))
invalidThisType(this: unique symbol);
>invalidThisType : Symbol(InvalidInterface.invalidThisType, Decl(uniqueSymbolsErrors.ts, 47, 39))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 48, 20))
>invalidThisType : Symbol(InvalidInterface.invalidThisType, Decl(uniqueSymbolsErrors.ts, 48, 39))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 49, 20))
invalidTypePredicate(n: any): n is unique symbol
>invalidTypePredicate : Symbol(InvalidInterface.invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 48, 41))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 49, 25))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 49, 25))
>invalidTypePredicate : Symbol(InvalidInterface.invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 49, 41))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 50, 25))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 50, 25))
invalidTypeParameterConstraint<T extends unique symbol>(): void;
>invalidTypeParameterConstraint : Symbol(InvalidInterface.invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 49, 52))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 50, 35))
>invalidTypeParameterConstraint : Symbol(InvalidInterface.invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 50, 52))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 51, 35))
invalidTypeParameterDefault<T = unique symbol>(): void;
>invalidTypeParameterDefault : Symbol(InvalidInterface.invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 50, 68))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 51, 32))
>invalidTypeParameterDefault : Symbol(InvalidInterface.invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 51, 68))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 52, 32))
}
// type literals
type InvalidTypeLiteral = {
>InvalidTypeLiteral : Symbol(InvalidTypeLiteral, Decl(uniqueSymbolsErrors.ts, 52, 1))
>InvalidTypeLiteral : Symbol(InvalidTypeLiteral, Decl(uniqueSymbolsErrors.ts, 53, 1))
invalidPropertyType: unique symbol;
>invalidPropertyType : Symbol(invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 55, 27))
>invalidPropertyType : Symbol(invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 56, 27))
invalidArgType(arg: unique symbol): void;
>invalidArgType : Symbol(invalidArgType, Decl(uniqueSymbolsErrors.ts, 56, 39))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 57, 19))
>invalidArgType : Symbol(invalidArgType, Decl(uniqueSymbolsErrors.ts, 57, 39))
>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 58, 19))
invalidRestArgType(...args: unique symbol[]): void;
>invalidRestArgType : Symbol(invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 57, 45))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 58, 23))
invalidRestArgType(...args: (unique symbol)[]): void;
>invalidRestArgType : Symbol(invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 58, 45))
>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 59, 23))
invalidReturnType(): unique symbol;
>invalidReturnType : Symbol(invalidReturnType, Decl(uniqueSymbolsErrors.ts, 58, 55))
>invalidReturnType : Symbol(invalidReturnType, Decl(uniqueSymbolsErrors.ts, 59, 57))
invalidThisType(this: unique symbol);
>invalidThisType : Symbol(invalidThisType, Decl(uniqueSymbolsErrors.ts, 59, 39))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 60, 20))
>invalidThisType : Symbol(invalidThisType, Decl(uniqueSymbolsErrors.ts, 60, 39))
>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 61, 20))
invalidTypePredicate(n: any): n is unique symbol
>invalidTypePredicate : Symbol(invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 60, 41))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 61, 25))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 61, 25))
>invalidTypePredicate : Symbol(invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 61, 41))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 62, 25))
>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 62, 25))
invalidTypeParameterConstraint<T extends unique symbol>(): void;
>invalidTypeParameterConstraint : Symbol(invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 61, 52))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 62, 35))
>invalidTypeParameterConstraint : Symbol(invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 62, 52))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 63, 35))
invalidTypeParameterDefault<T = unique symbol>(): void;
>invalidTypeParameterDefault : Symbol(invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 62, 68))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 63, 32))
>invalidTypeParameterDefault : Symbol(invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 63, 68))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 64, 32))
};
// type alias
type InvalidAlias = unique symbol;
>InvalidAlias : Symbol(InvalidAlias, Decl(uniqueSymbolsErrors.ts, 64, 2))
>InvalidAlias : Symbol(InvalidAlias, Decl(uniqueSymbolsErrors.ts, 65, 2))
type InvalidAliasTypeParameterConstraint<T extends unique symbol> = never;
>InvalidAliasTypeParameterConstraint : Symbol(InvalidAliasTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 67, 34))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 68, 41))
>InvalidAliasTypeParameterConstraint : Symbol(InvalidAliasTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 68, 34))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 69, 41))
type InvalidAliasTypeParameterDefault<T extends unique symbol> = never;
>InvalidAliasTypeParameterDefault : Symbol(InvalidAliasTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 68, 74))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 69, 38))
>InvalidAliasTypeParameterDefault : Symbol(InvalidAliasTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 69, 74))
>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 70, 38))
// type references
declare const invalidTypeArgument: Promise<unique symbol>;
>invalidTypeArgument : Symbol(invalidTypeArgument, Decl(uniqueSymbolsErrors.ts, 72, 13))
>invalidTypeArgument : Symbol(invalidTypeArgument, Decl(uniqueSymbolsErrors.ts, 73, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
declare const invalidArrayType: unique symbol[];
>invalidArrayType : Symbol(invalidArrayType, Decl(uniqueSymbolsErrors.ts, 73, 13))
declare const invalidArrayType: (unique symbol)[];
>invalidArrayType : Symbol(invalidArrayType, Decl(uniqueSymbolsErrors.ts, 74, 13))
declare const invalidTupleType: [unique symbol];
>invalidTupleType : Symbol(invalidTupleType, Decl(uniqueSymbolsErrors.ts, 74, 13))
>invalidTupleType : Symbol(invalidTupleType, Decl(uniqueSymbolsErrors.ts, 75, 13))
// mapped types
declare const invalidMappedType: { [P in string]: unique symbol };
>invalidMappedType : Symbol(invalidMappedType, Decl(uniqueSymbolsErrors.ts, 77, 13))
>P : Symbol(P, Decl(uniqueSymbolsErrors.ts, 77, 36))
>invalidMappedType : Symbol(invalidMappedType, Decl(uniqueSymbolsErrors.ts, 78, 13))
>P : Symbol(P, Decl(uniqueSymbolsErrors.ts, 78, 36))
// unions/intersection
declare const invalidUnion: unique symbol | unique symbol;
>invalidUnion : Symbol(invalidUnion, Decl(uniqueSymbolsErrors.ts, 80, 13))
>invalidUnion : Symbol(invalidUnion, Decl(uniqueSymbolsErrors.ts, 81, 13))
declare const invalidIntersection: unique symbol | unique symbol;
>invalidIntersection : Symbol(invalidIntersection, Decl(uniqueSymbolsErrors.ts, 81, 13))
>invalidIntersection : Symbol(invalidIntersection, Decl(uniqueSymbolsErrors.ts, 82, 13))

View File

@@ -1,5 +1,8 @@
=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts ===
// declarations
declare const invalidUniqueType: unique number;
>invalidUniqueType : any
declare const {}: unique symbol;
declare let invalidLetType: unique symbol;
>invalidLetType : symbol
@@ -12,7 +15,7 @@ declare function invalidArgType(arg: unique symbol): void;
>invalidArgType : (arg: symbol) => void
>arg : symbol
declare function invalidRestArgType(...arg: unique symbol[]): void;
declare function invalidRestArgType(...arg: (unique symbol)[]): void;
>invalidRestArgType : (...arg: symbol[]) => void
>arg : symbol[]
@@ -53,7 +56,7 @@ class InvalidClass {
>invalidArgType : (arg: symbol) => void
>arg : symbol
invalidRestArgType(...args: unique symbol[]): void { return; }
invalidRestArgType(...args: (unique symbol)[]): void { return; }
>invalidRestArgType : (...args: symbol[]) => void
>args : symbol[]
@@ -91,7 +94,7 @@ class InvalidClass {
>invalidStaticArgType : (arg: symbol) => void
>arg : symbol
static invalidStaticRestArgType(...args: unique symbol[]): void { return; }
static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; }
>invalidStaticRestArgType : (...args: symbol[]) => void
>args : symbol[]
@@ -134,7 +137,7 @@ interface InvalidInterface {
>invalidArgType : (arg: symbol) => void
>arg : symbol
invalidRestArgType(...args: unique symbol[]): void;
invalidRestArgType(...args: (unique symbol)[]): void;
>invalidRestArgType : (...args: symbol[]) => void
>args : symbol[]
@@ -170,7 +173,7 @@ type InvalidTypeLiteral = {
>invalidArgType : (arg: symbol) => void
>arg : symbol
invalidRestArgType(...args: unique symbol[]): void;
invalidRestArgType(...args: (unique symbol)[]): void;
>invalidRestArgType : (...args: symbol[]) => void
>args : symbol[]
@@ -213,7 +216,7 @@ declare const invalidTypeArgument: Promise<unique symbol>;
>invalidTypeArgument : Promise<symbol>
>Promise : Promise<T>
declare const invalidArrayType: unique symbol[];
declare const invalidArrayType: (unique symbol)[];
>invalidArrayType : symbol[]
declare const invalidTupleType: [unique symbol];

View File

@@ -1,13 +1,14 @@
// @target: esnext
// declarations
declare const invalidUniqueType: unique number;
declare const {}: unique symbol;
declare let invalidLetType: unique symbol;
declare var invalidVarType: unique symbol;
// function arguments and return types
declare function invalidArgType(arg: unique symbol): void;
declare function invalidRestArgType(...arg: unique symbol[]): void;
declare function invalidRestArgType(...arg: (unique symbol)[]): void;
declare function invalidReturnType(): unique symbol;
declare function invalidThisType(this: unique symbol): void;
declare function invalidTypePredicate(n: any): n is unique symbol;
@@ -21,7 +22,7 @@ class InvalidClass {
readonly invalidReadonlyPropertyType: unique symbol;
invalidPropertyType: unique symbol;
invalidArgType(arg: unique symbol): void { return; }
invalidRestArgType(...args: unique symbol[]): void { return; }
invalidRestArgType(...args: (unique symbol)[]): void { return; }
invalidReturnType(): unique symbol { return; }
invalidThisType(this: unique symbol): void { return; }
invalidTypePredicate(n: any): n is unique symbol { return; }
@@ -32,7 +33,7 @@ class InvalidClass {
static invalidStaticPropertyType: unique symbol;
static invalidStaticArgType(arg: unique symbol): void { return; }
static invalidStaticRestArgType(...args: unique symbol[]): void { return; }
static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; }
static invalidStaticReturnType(): unique symbol { return; }
static invalidStaticThisType(this: unique symbol): void { return; }
static invalidStaticTypePredicate(n: any): n is unique symbol { return; }
@@ -46,7 +47,7 @@ class InvalidClass {
interface InvalidInterface {
invalidPropertyType: unique symbol;
invalidArgType(arg: unique symbol): void;
invalidRestArgType(...args: unique symbol[]): void;
invalidRestArgType(...args: (unique symbol)[]): void;
invalidReturnType(): unique symbol;
invalidThisType(this: unique symbol);
invalidTypePredicate(n: any): n is unique symbol
@@ -58,7 +59,7 @@ interface InvalidInterface {
type InvalidTypeLiteral = {
invalidPropertyType: unique symbol;
invalidArgType(arg: unique symbol): void;
invalidRestArgType(...args: unique symbol[]): void;
invalidRestArgType(...args: (unique symbol)[]): void;
invalidReturnType(): unique symbol;
invalidThisType(this: unique symbol);
invalidTypePredicate(n: any): n is unique symbol
@@ -73,7 +74,7 @@ type InvalidAliasTypeParameterDefault<T extends unique symbol> = never;
// type references
declare const invalidTypeArgument: Promise<unique symbol>;
declare const invalidArrayType: unique symbol[];
declare const invalidArrayType: (unique symbol)[];
declare const invalidTupleType: [unique symbol];
// mapped types