Skip to content

Debug failure in getLiteralTypeFromPropertyName #22403

@ghost

Description

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)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions