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

StackOverflowError during template instantiation when same name is chosen #421

Closed
Mi-La opened this issue Sep 30, 2022 · 1 comment
Closed
Assignees
Labels
bug Something isn't working core Zserio core module templates Related to templates mechanism
Milestone

Comments

@Mi-La
Copy link
Contributor

Mi-La commented Sep 30, 2022

Consider following schemas:
templates.zs

package templates;
struct MyTemplate<T>
{
    T field;
};

test.zs

package test;

import templates.*;

instantiate MyTemplate<uint32> MyTemplate;

Zserio compilation ends with the following error:

Parsing test.zs
Parsing templates.zs
[ERROR] Internal error: java.lang.StackOverflowError
	at zserio.ast.TypeReference.visitChildren(TypeReference.java:61)
	at zserio.ast.ZserioAstTypeResolver.visitTypeReference(ZserioAstTypeResolver.java:62)
        ...

Note that when the single import is used in test.zs, proper error is fired:

-import templates.*;
+import templates.MyTemplate;
Parsing test.zs
Parsing templates.zs
[ERROR] templates.zs:2:8:     Found here
[ERROR] test.zs:5:32:     Found here
[ERROR] test.zs:5:13: Ambiguous symbol 'MyTemplate'

@Mi-La Mi-La added bug Something isn't working core Zserio core module templates Related to templates mechanism labels Sep 30, 2022
@mikir mikir added this to the Priority Backlog milestone Sep 30, 2022
@Mi-La Mi-La modified the milestones: Priority Backlog, 2.9 Oct 25, 2022
@Mi-La
Copy link
Contributor Author

Mi-La commented Oct 31, 2022

Check also subtypes with the same use-case.

@Mi-La Mi-La self-assigned this Oct 31, 2022
Mi-La added a commit that referenced this issue Nov 1, 2022
@mikir mikir closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Zserio core module templates Related to templates mechanism
Projects
None yet
Development

No branches or pull requests

2 participants