Skip to content

Stack overflow with circular type parameter default #18234

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

Closed
ahejlsberg opened this issue Sep 4, 2017 · 2 comments
Closed

Stack overflow with circular type parameter default #18234

ahejlsberg opened this issue Sep 4, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@ahejlsberg
Copy link
Member

ahejlsberg commented Sep 4, 2017

Issue originally reported by @bcherny in #17036 (comment).

Repro:

interface A<B = A> {
  a: B
}

Compiling the above causes a stack overflow:

RangeError: Maximum call stack size exceeded
    at getSymbol (c:\ts\built\local\tsc.js:23459:27)
    at resolveNameHelper (c:\ts\built\local\tsc.js:23710:38)
    at resolveName (c:\ts\built\local\tsc.js:23596:20)
    at resolveEntityName (c:\ts\built\local\tsc.js:24285:26)
    at resolveTypeReferenceName (c:\ts\built\local\tsc.js:29082:20)
    at getTypeFromTypeReference (c:\ts\built\local\tsc.js:29179:30)
    at getTypeFromTypeNode (c:\ts\built\local\tsc.js:30072:28)
    at getDefaultFromTypeParameter (c:\ts\built\local\tsc.js:28320:66)
    at getMinTypeArgumentCount (c:\ts\built\local\tsc.js:28591:26)
    at getTypeFromClassOrInterfaceReference (c:\ts\built\local\tsc.js:28999:44)
    at getTypeReferenceTypeWorker (c:\ts\built\local\tsc.js:29112:24)
    at getTypeReferenceType (c:\ts\built\local\tsc.js:29089:24)
    at getTypeFromTypeReference (c:\ts\built\local\tsc.js:29180:28)
    at getTypeFromTypeNode (c:\ts\built\local\tsc.js:30072:28)
    at getDefaultFromTypeParameter (c:\ts\built\local\tsc.js:28320:66)
    at getMinTypeArgumentCount (c:\ts\built\local\tsc.js:28591:26)
    at getTypeFromClassOrInterfaceReference (c:\ts\built\local\tsc.js:28999:44)
    at getTypeReferenceTypeWorker (c:\ts\built\local\tsc.js:29112:24)
    at getTypeReferenceType (c:\ts\built\local\tsc.js:29089:24)
    at getTypeFromTypeReference (c:\ts\built\local\tsc.js:29180:28)
    at getTypeFromTypeNode (c:\ts\built\local\tsc.js:30072:28)
    at getDefaultFromTypeParameter (c:\ts\built\local\tsc.js:28320:66)
    at getMinTypeArgumentCount (c:\ts\built\local\tsc.js:28591:26)
    at getTypeFromClassOrInterfaceReference (c:\ts\built\local\tsc.js:28999:44)
    at getTypeReferenceTypeWorker (c:\ts\built\local\tsc.js:29112:24)
    at getTypeReferenceType (c:\ts\built\local\tsc.js:29089:24)
    at getTypeFromTypeReference (c:\ts\built\local\tsc.js:29180:28)
    at getTypeFromTypeNode (c:\ts\built\local\tsc.js:30072:28)
    at getDefaultFromTypeParameter (c:\ts\built\local\tsc.js:28320:66)
    at getMinTypeArgumentCount (c:\ts\built\local\tsc.js:28591:26)
    at getTypeFromClassOrInterfaceReference (c:\ts\built\local\tsc.js:28999:44)
    at getTypeReferenceTypeWorker (c:\ts\built\local\tsc.js:29112:24)
    at getTypeReferenceType (c:\ts\built\local\tsc.js:29089:24)
    at getTypeFromTypeReference (c:\ts\built\local\tsc.js:29180:28)
    at getTypeFromTypeNode (c:\ts\built\local\tsc.js:30072:28)
    at getDefaultFromTypeParameter (c:\ts\built\local\tsc.js:28320:66)
    at getMinTypeArgumentCount (c:\ts\built\local\tsc.js:28591:26)
    at getTypeFromClassOrInterfaceReference (c:\ts\built\local\tsc.js:28999:44)
    at getTypeReferenceTypeWorker (c:\ts\built\local\tsc.js:29112:24)
    at getTypeReferenceType (c:\ts\built\local\tsc.js:29089:24)
    at getTypeFromTypeReference (c:\ts\built\local\tsc.js:29180:28)
    at getTypeFromTypeNode (c:\ts\built\local\tsc.js:30072:28)
    at getDefaultFromTypeParameter (c:\ts\built\local\tsc.js:28320:66)
    at getMinTypeArgumentCount (c:\ts\built\local\tsc.js:28591:26)
@ahejlsberg ahejlsberg added the Bug A bug in TypeScript label Sep 4, 2017
@ahejlsberg ahejlsberg added this to the TypeScript 2.6 milestone Sep 4, 2017
@jcalz
Copy link
Contributor

jcalz commented Sep 4, 2017

Related to or same as #16221 and/or #16533?

@ahejlsberg
Copy link
Member Author

Yes, dupe of #16533. Thanks!

@ahejlsberg ahejlsberg added Duplicate An existing issue was already created and removed Bug A bug in TypeScript labels Sep 4, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants