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. False expression: isDeclarationVisible unknown: SyntaxKind: 209 #2221

Closed
csnover opened this issue Mar 6, 2015 · 11 comments · Fixed by #2557
Closed

Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 209 #2221

csnover opened this issue Mar 6, 2015 · 11 comments · Fixed by #2557
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@csnover
Copy link
Contributor

csnover commented Mar 6, 2015

// A.ts
class A {}
export = A;
// B.ts
import A from './A';
export function getA(): A { return null; }

Command: tsd -m amd -t es5 -d B.ts

Expected: No error
Actual: Crash

Error: Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 204
    at Object.assert (/srv/devel/web/typescript/bin/tsc.js:601:23)
    at Object.fail (/srv/devel/web/typescript/bin/tsc.js:606:19)
    at determineIfDeclarationIsVisible (/srv/devel/web/typescript/bin/tsc.js:8884:34)
    at isDeclarationVisible (/srv/devel/web/typescript/bin/tsc.js:8890:41)
    at getIsDeclarationVisible (/srv/devel/web/typescript/bin/tsc.js:8321:22)
    at /srv/devel/web/typescript/bin/tsc.js:8316:82
    at Object.forEach (/srv/devel/web/typescript/bin/tsc.js:36:30)
    at hasVisibleDeclarations (/srv/devel/web/typescript/bin/tsc.js:8316:20)
    at Object.isEntityNameVisible (/srv/devel/web/typescript/bin/tsc.js:8355:31)
    at emitEntityName (/srv/devel/web/typescript/bin/tsc.js:17361:49)

Function signature emitter for declarations seems to not understand import types so is failing on the return type of the function getA. This happens even with PR #2197 applied. There is no crash if -d is not used.

Version: Arnavion/typescript-github#2015-03-05-b784a4212aeb5a4e42a598a8613a0538ac241123

@mhegazy
Copy link
Contributor

mhegazy commented Mar 6, 2015

The .d.ts part is not yet applied. the changes are in #2139

@csnover
Copy link
Contributor Author

csnover commented Mar 6, 2015

The .d.ts part is not yet applied. the changes are in #2139

Oh. Do you have a meta-ticket tracking the ES6 module features somewhere? I haven’t been able to find one to figure out the status. Applying that PR does seem to fix this issue so it would be great to see it land soon 👍 .

@mhegazy
Copy link
Contributor

mhegazy commented Mar 6, 2015

We should be putting out a write up of the ES6 module work. it has been done rather incrementally, but we should have a roll up out in the next few days.

@danquirk
Copy link
Member

See #2242. Sounds like this is just an artifact of the work in progress state so I'm going to close the issue. Please re-open if I've misunderstood or you're still seeing an issue with the latest bits.

@csnover
Copy link
Contributor Author

csnover commented Mar 10, 2015

Thanks @danquirk. You are absolutely right in your understanding. #2139 fixes this assertion failure.

@csnover
Copy link
Contributor Author

csnover commented Mar 20, 2015

New twist on the same theme, now that #2139 is landed. Are you aware of this failure now when outputting declarations?:

Error: Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 209
    at Object.assert (typescript/bin/typescript.js:1209:23)
    at Object.fail (typescript/bin/typescript.js:1214:19)
    at determineIfDeclarationIsVisible (typescript/bin/typescript.js:10033:34)
    at isDeclarationVisible (typescript/bin/typescript.js:10039:41)
    at getIsDeclarationVisible (typescript/bin/typescript.js:9455:22)
    at typescript/bin/typescript.js:9450:82
    at Object.forEach (typescript/bin/typescript.js:618:30)
    at hasVisibleDeclarations (typescript/bin/typescript.js:9450:20)
    at Object.isSymbolAccessible (typescript/bin/typescript.js:9406:57)
    at Object.trackSymbol (typescript/bin/typescript.js:18530:53)
    at buildSymbolDisplay (typescript/bin/typescript.js:9564:24)
    at writeType (typescript/bin/typescript.js:9609:25)
    at Object.buildTypeDisplay (typescript/bin/typescript.js:9599:24)
    at Object.writeReturnTypeOfSignatureDeclaration (typescript/bin/typescript.js:17453:39)
    at writeReturnTypeAtSignature (typescript/bin/typescript.js:18549:26)
    at emitSignatureDeclaration (typescript/bin/typescript.js:19354:17)

I can do more debugging on my end if it’s not immediately apparent what this failure is. (I was hoping to have more info but it’s been an impossible day to get anything done.)

(build 3e7e9f4)

@mhegazy mhegazy reopened this Mar 20, 2015
@mhegazy mhegazy added this to the TypeScript 1.5 milestone Mar 20, 2015
@mhegazy mhegazy added the Bug A bug in TypeScript label Mar 20, 2015
@mhegazy mhegazy self-assigned this Mar 20, 2015
@csnover
Copy link
Contributor Author

csnover commented Mar 20, 2015

@mhegazy here is the minimal repro for the new case, which actually makes it a regression since this same code works fine in 1.4:

class A {
    foo() {
        var aVal:A.B;
        return aVal;
    }
}

module A {
    export interface B {}
}

export = A;

The bug is not reproduced if the return value of foo is specified explicitly.

@csnover csnover changed the title Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 204 Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 209 Mar 20, 2015
@danquirk
Copy link
Member

What bits are you reproing this with? I just did a sync and build and that snippet compiles without error on the latest bits in master.

@csnover
Copy link
Contributor Author

csnover commented Mar 20, 2015

Build 3e7e9f4. I can try with master also to verify it still happens. Make sure to use -d, it compiles fine without generating definitions.

@csnover
Copy link
Contributor Author

csnover commented Mar 20, 2015

I can still reproduce on master (0d2a5bb).

// A.ts
class A {
    foo() {
        var aVal:A.B;
        return aVal;
    }
}

module A {
    export interface B {}
}

export = A;

Run: tsc -d -m amd -t es5 A.ts
Expected: No error
Actual:

typescript/bin/tsc.js:623
                throw new Error("Debug Failure. False expression: " + (message
                      ^
Error: Debug Failure. False expression: isDeclarationVisible unknown: SyntaxKind: 209
    at Object.assert (typescript/bin/tsc.js:623:23)
    at Object.fail (typescript/bin/tsc.js:628:19)
    at determineIfDeclarationIsVisible (typescript/bin/tsc.js:9406:34)
    at isDeclarationVisible (typescript/bin/tsc.js:9412:41)
    at getIsDeclarationVisible (typescript/bin/tsc.js:8828:22)
    at typescript/bin/tsc.js:8823:82
    at Object.forEach (typescript/bin/tsc.js:37:30)
    at hasVisibleDeclarations (typescript/bin/tsc.js:8823:20)
    at Object.isSymbolAccessible (typescript/bin/tsc.js:8779:57)
    at Object.trackSymbol (typescript/bin/tsc.js:17909:53)

@danquirk
Copy link
Member

Yep, my bad, forgot -d.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 1, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 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.

3 participants