Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug failure in getLiteralTypeFromPropertyName #22403

Closed
ghost opened this issue Mar 8, 2018 · 12 comments · Fixed by #22406
Closed

Debug failure in getLiteralTypeFromPropertyName #22403

ghost opened this issue Mar 8, 2018 · 12 comments · Fixed by #22406
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ghost
Copy link

ghost commented Mar 8, 2018

TypeScript Version: 2.8.0-dev.20180308

Code

// @Filename: /a.ts
import x = require("something");
export { x };

// @Filename: /b.ts
import a = require('./a');
declare function f<T>(obj: T, key: keyof T): void;
f(a, "");

Expected behavior:

No error.

Actual behavior:

  1) compiler tests
       compiler tests for tests/cases/compiler/foo.ts
         "before all" hook:
     Error: Debug Failure. False expression: Target symbol and symbol do not have the same name
      at getLiteralTypeFromPropertyName (src\compiler\checker.ts:8014:27)
      at Object.map (src\compiler\core.ts:422:29)
      at getLiteralTypeFromPropertyNames (src\compiler\checker.ts:8027:33)
      at getIndexType (src\compiler\checker.ts:8036:17)
      at instantiateType (src\compiler\checker.ts:9028:28)
      at getTypeOfInstantiatedSymbol (src\compiler\checker.ts:4628:32)
      at getTypeOfSymbol (src\compiler\checker.ts:4656:24)
      at getTypeOfParameter (src\compiler\checker.ts:18243:26)
      at getTypeAtPosition (src\compiler\checker.ts:18256:53)
      at checkApplicableSignature (src\compiler\checker.ts:16964:39)
      at chooseOverload (src\compiler\checker.ts:17548:30)
      at resolveCall (src\compiler\checker.ts:17407:26)
      at resolveCallExpression (src\compiler\checker.ts:17650:20)
      at resolveSignature (src\compiler\checker.ts:17945:28)
      at getResolvedSignature (src\compiler\checker.ts:17978:28)
      at checkCallExpression (src\compiler\checker.ts:18043:31)
      at checkExpressionWorker (src\compiler\checker.ts:19758:28)
      at checkExpression (src\compiler\checker.ts:19690:44)
      at checkExpressionStatement (src\compiler\checker.ts:22220:13)
      at checkSourceElement (src\compiler\checker.ts:24332:28)
      at Object.forEach (src\compiler\core.ts:179:32)
      at checkSourceFileWorker (src\compiler\checker.ts:24515:17)
      at checkSourceFile (src\compiler\checker.ts:24489:13)
      at Object.forEach (src\compiler\core.ts:179:32)
      at getDiagnosticsWorker (src\compiler\checker.ts:24591:13)
      at getDiagnostics (src\compiler\checker.ts:24554:24)
      at Object.getEmitResolver (src\compiler\checker.ts:808:13)
      at emitWorker (src\compiler\program.ts:1180:71)
      at src\compiler\program.ts:1131:51
      at runWithCancellationToken (src\compiler\program.ts:1253:24)
      at Object.emit (src\compiler\program.ts:1131:20)
      at Object.compileFiles (src\harness\harness.ts:1231:40)
      at Context.<anonymous> (src\harness\compilerRunner.ts:116:49)
@ghost ghost added the Bug A bug in TypeScript label Mar 8, 2018
@mhegazy mhegazy added this to the TypeScript 2.8 milestone Mar 8, 2018
@ghost
Copy link
Author

ghost commented Mar 8, 2018

@weswigham Looks like this is caused by #22339 -- broken in 16bf029 but works in the previous commit 53ae507

@mmorearty
Copy link
Contributor

FYI I am seeing this same error in typescript@rc. I will try to create a small repro case from my huge code base. If I can do that, do you want me to add it as a comment on this issue, or open a new issue (referencing this one)?

@weswigham
Copy link
Member

We removed the assertion in question yesterday, it won't be there in the 2.8 release.

@cah-sam-beran
Copy link

@weswigham @mhegazy this change is still present in the 2.8 release - I am seeing the error 😳 . https://unpkg.com/[email protected]/lib/typescript.js contains the string "Target symbol and symbol do not have the same name" - is it possible there was an issue when the release was created?

@weswigham
Copy link
Member

@mhegazy did we cut 2.8 before the associated PR was merged?

@sberan
Copy link

sberan commented Mar 27, 2018

@weswigham @mhegazy my apologies, I misread #22403 (comment) - I see that this fix will be in the next release.

@amanmahajan7
Copy link

Hi, facing the same issue. Is there a workaround for this issue other that pinning to 2.7.x? Thank you for your help.

@nicojs
Copy link

nicojs commented Apr 3, 2018

@sberan you mean in the TS2.8.2 release?

@cah-sam-beran
Copy link

@nicojs I misparsed the " it won't be there in the 2.8 release" statement - this definitely is still an issue in 2.8.1 and is blocking my project from upgrading to TS 2.8.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 3, 2018

@cah-sberan looks like you are running into a different issue. can you share more context. can you share a sample project that we can debug against?

@cah-sam-beran
Copy link

@mhegazy #22920 definitely fixes my issue, it will be in the 2.8.2 release. Cheers!

@weswigham
Copy link
Member

weswigham commented Apr 3, 2018

No, @mhegazy this didn't hit the 2.8 release, so is likely the same issue. It's in the 2.8 branch now (so will be in 2.8.2), but AFAIK the release branch was cut before it was merged.

@mhegazy mhegazy modified the milestones: TypeScript 2.8, TypeScript 2.8.2 Apr 3, 2018
harsimranb added a commit to emgage/engage-ui that referenced this issue Apr 8, 2018
Notes:
1. Using nightly TypeScript because of bug microsoft/TypeScript#22403
2. ESLint trailing commas also disabled for now due to bug
3. Minor issue that docs aren't running.  needs diagnosis
harsimranb added a commit to emgage/engage-ui that referenced this issue Apr 15, 2018
* removed unused table and velocity-animate

* React version upgraded to version 16.3.1.
Notes:
1. Using nightly TypeScript because of bug microsoft/TypeScript#22403
2. ESLint trailing commas also disabled for now due to bug
3. Minor issue that docs aren't running.  needs diagnosis

* unit test fix in progress

* unit test fixes for enzyme 2

* - added test debug capability
- fixed tests for formlayout, stack, textfield, tooltip

* fixed unit tests in scrollable, select, stack, and tooltip.

* fixed/commented broken tests with TODO to expedite development for dheeraj

* upgraded to react 16.3.1
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants