-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-2111: As a developer I'd like to use type aliases as values (esp. …
…in JSX tags) -- preparations (#2112) * improve handling of IdentifierRefs pointing to type aliases
- Loading branch information
Showing
4 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...n4js.spec.tests/xpect-tests/Ch04_14__TypeAlias/TypeAlias_validation_usedAsValue2.n4jsx.xt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2021 NumberFour AG. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* NumberFour AG - Initial API and implementation | ||
*/ | ||
|
||
/* XPECT_SETUP org.eclipse.n4js.spec.tests.N4JSSpecTest END_SETUP */ | ||
|
||
|
||
function foo(p: constructor{?}) {} | ||
|
||
class Cls {} | ||
|
||
type A = Cls; | ||
|
||
// XPECT errors --> "A type alias may not be used as a value." at "A" | ||
A; | ||
// XPECT errors --> "A type alias may not be used as a value." at "A" | ||
new A(); | ||
// XPECT errors --> "A type alias may not be used as a value." at "A" | ||
foo(A); | ||
// XPECT errors --- | ||
// "A type alias may not be used as a value." at "A" | ||
// "Cannot resolve JSX implementation." at "<A/>" | ||
// --- | ||
<A/>; | ||
|
||
// note: the above also tests that we do not get unnecessary duplicate error messages. |