Don't ever use resolveEntityName here

This commit is contained in:
Ryan Cavanaugh
2016-02-11 11:37:55 -08:00
parent 48c5bcf148
commit 13167f53e6
12 changed files with 8 additions and 65 deletions
+1 -1
View File
@@ -8481,7 +8481,7 @@ namespace ts {
return getIntrinsicTagSymbol(node);
}
else {
return resolveEntityName(node.tagName, SymbolFlags.Value);
return checkExpression(node.tagName).symbol;
}
}
@@ -4,12 +4,10 @@ tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,29): error TS1005: '{'
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,57): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,58): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,1): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,8): error TS2503: Cannot find namespace 'a'.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,12): error TS2657: JSX expressions must have one parent element
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(43,10): error TS2503: Cannot find namespace 'a'.
==== tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx (9 errors) ====
==== tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx (7 errors) ====
declare var React: any;
declare var 日本語;
declare var AbC_def;
@@ -63,14 +61,10 @@ tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(43,10): error TS2503: Cann
<a.b></a.b>;
~
!!! error TS1003: Identifier expected.
~
!!! error TS2503: Cannot find namespace 'a'.
~
!!! error TS2657: JSX expressions must have one parent element
<a.b.c></a.b.c>;
~
!!! error TS2503: Cannot find namespace 'a'.
(<div />) < x;
@@ -24,7 +24,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,12): error TS2304:
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,16): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,2): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,5): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,10): error TS2503: Cannot find namespace 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,10): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,13): error TS1005: '>' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,14): error TS2304: Cannot find name 'c'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,16): error TS1109: Expression expected.
@@ -38,7 +38,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,8): error TS2304:
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,10): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,2): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,4): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,7): error TS2503: Cannot find namespace 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,7): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,9): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,3): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,4): error TS2304: Cannot find name 'foo'.
@@ -135,7 +135,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS1005:
~
!!! error TS1003: Identifier expected.
~
!!! error TS2503: Cannot find namespace 'a'.
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS1005: '>' expected.
~
@@ -166,7 +166,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS1005:
~
!!! error TS1003: Identifier expected.
~
!!! error TS2503: Cannot find namespace 'a'.
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS1003: Identifier expected.
<a[foo]></a[foo]>;
@@ -56,11 +56,9 @@ declare var hasOwnProperty:any;
>div : Symbol(unknown)
<Component>{foo}<br />{bar}</Component>
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>foo : Symbol(foo, Decl(jsxReactTestSuite.tsx, 7, 11))
>br : Symbol(unknown)
>bar : Symbol(bar, Decl(jsxReactTestSuite.tsx, 8, 11))
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
<br />
>br : Symbol(unknown)
@@ -70,20 +68,12 @@ declare var hasOwnProperty:any;
<Composite>
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
{this.props.children}
</Composite>;
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
<Composite>
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
<Composite2 />
>Composite2 : Symbol(Composite2, Decl(jsxReactTestSuite.tsx, 4, 11))
</Composite>;
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
var x =
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
@@ -174,7 +164,6 @@ var x =
>hasOwnProperty : Symbol(unknown)
<Component constructor="foo" />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>constructor : Symbol(unknown)
<Namespace.Component />;
@@ -182,7 +171,6 @@ var x =
<Namespace.DeepNamespace.Component />;
<Component { ... x } y
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
>y : Symbol(unknown)
@@ -190,8 +178,6 @@ var x =
>z : Symbol(unknown)
<Component
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
{...this.props} sound="moo" />;
>sound : Symbol(unknown)
@@ -199,7 +185,6 @@ var x =
>font-face : Symbol(unknown)
<Component x={y} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11))
@@ -207,43 +192,34 @@ var x =
>x-component : Symbol(unknown)
<Component {...x} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
<Component { ...x } y={2} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
>y : Symbol(unknown)
<Component { ... x } y={2} z />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
>y : Symbol(unknown)
>z : Symbol(unknown)
<Component x={1} {...y} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11))
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>y : Symbol(unknown)
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
>Child : Symbol(Child, Decl(jsxReactTestSuite.tsx, 5, 11))
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 113, 27))
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
>z : Symbol(unknown)
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
@@ -17,7 +17,6 @@ declare var x: any;
>data : Symbol(unknown)
<Bar x={x} />;
>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11))
>x : Symbol(unknown)
>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11))
@@ -25,11 +24,9 @@ declare var x: any;
>x-component : Symbol(unknown)
<Bar {...x} />;
>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11))
>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11))
<Bar { ...x } y={2} />;
>Bar : Symbol(Bar, Decl(reactNamespaceJSXEmit.tsx, 3, 11))
>x : Symbol(x, Decl(reactNamespaceJSXEmit.tsx, 4, 11))
>y : Symbol(unknown)
@@ -18,15 +18,11 @@ declare var Foo, React;
// Should see mod_1['default'] in emit here
<Foo handler={Main}></Foo>;
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
>handler : Symbol(unknown)
>Main : Symbol(Main, Decl(app.tsx, 0, 6))
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
// Should see mod_1['default'] in emit here
<Foo {...Main}></Foo>;
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
>Main : Symbol(Main, Decl(app.tsx, 0, 6))
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
@@ -15,8 +15,6 @@ var T, T1, T2;
// This is an element
var x1 = <T>() => {}</T>;
>x1 : Symbol(x1, Decl(file.tsx, 7, 3))
>T : Symbol(T, Decl(file.tsx, 4, 3))
>T : Symbol(T, Decl(file.tsx, 4, 3))
x1.isElement;
>x1.isElement : Symbol(JSX.Element.isElement, Decl(file.tsx, 1, 20))
@@ -43,9 +41,7 @@ x3();
// This is an element
var x4 = <T extends={true}>() => {}</T>;
>x4 : Symbol(x4, Decl(file.tsx, 19, 3))
>T : Symbol(T, Decl(file.tsx, 4, 3))
>extends : Symbol(unknown)
>T : Symbol(T, Decl(file.tsx, 4, 3))
x4.isElement;
>x4.isElement : Symbol(JSX.Element.isElement, Decl(file.tsx, 1, 20))
@@ -55,9 +51,7 @@ x4.isElement;
// This is an element
var x5 = <T extends>() => {}</T>;
>x5 : Symbol(x5, Decl(file.tsx, 23, 3))
>T : Symbol(T, Decl(file.tsx, 4, 3))
>extends : Symbol(unknown)
>T : Symbol(T, Decl(file.tsx, 4, 3))
x5.isElement;
>x5.isElement : Symbol(JSX.Element.isElement, Decl(file.tsx, 1, 20))
@@ -16,6 +16,4 @@ declare module A.B.C {
}
<A.B.C.D>foo</A . B . C.D>
>D : Symbol(A.B.C.D, Decl(file.tsx, 5, 5))
>D : Symbol(A.B.C.D, Decl(file.tsx, 5, 5))
@@ -13,7 +13,6 @@ import Route = ReactRouter.Route;
var routes1 = <Route />;
>routes1 : Symbol(routes1, Decl(test.tsx, 6, 3))
>Route : Symbol(ReactRouter.Route, Decl(react.d.ts, 7, 4))
module M {
>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1))
@@ -27,8 +26,6 @@ module M {
// Should emit 'M.X' in both opening and closing tags
var y = <X></X>;
>y : Symbol(y, Decl(test.tsx, 13, 4))
>X : Symbol(X, Decl(test.tsx, 9, 11))
>X : Symbol(X, Decl(test.tsx, 9, 11))
}
=== tests/cases/conformance/jsx/react.d.ts ===
@@ -6,5 +6,4 @@ var Route: any;
var routes1 = <Route />;
>routes1 : Symbol(routes1, Decl(test.tsx, 3, 3))
>Route : Symbol(Route, Decl(test.tsx, 2, 3))
@@ -13,11 +13,3 @@ declare var Foo, Bar, baz;
>baz : Symbol(baz, Decl(test.tsx, 4, 21))
<Foo> <Bar> q </Bar> <Bar/> s <Bar/><Bar/></Foo>;
>Foo : Symbol(Foo, Decl(test.tsx, 4, 11))
>Bar : Symbol(Bar, Decl(test.tsx, 4, 16))
>Bar : Symbol(Bar, Decl(test.tsx, 4, 16))
>Bar : Symbol(Bar, Decl(test.tsx, 4, 16))
>Bar : Symbol(Bar, Decl(test.tsx, 4, 16))
>Bar : Symbol(Bar, Decl(test.tsx, 4, 16))
>Foo : Symbol(Foo, Decl(test.tsx, 4, 11))
@@ -11,7 +11,7 @@ const Foo = (props: any) => <div/>;
// Should be OK
const foo = <Foo />;
>foo : Symbol(foo, Decl(file.tsx, 5, 5))
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
>Foo : Symbol((Anonymous function), Decl(file.tsx, 3, 11))
// Should be OK
@@ -40,7 +40,7 @@ var App: React.StatelessComponent<{ children }> = ({children}) => (
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45))
<MainMenu/>
>MainMenu : Symbol(MainMenu, Decl(file.tsx, 9, 3))
>MainMenu : Symbol(React.StatelessComponent, Decl(react.d.ts, 139, 5))
</div>
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 927, 45))