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

Fix recursive pointerof detection with generic splat type variables #11811

Merged

Conversation

HertzDevil
Copy link
Contributor

Fixes #11808. This happens with any generic class type that has a splat type parameter, not just Tuple.

class Foo(*T); end

x = Foo(Int32).new
x = pointerof(x) # Error: recursive pointerof expansion: Pointer(Foo(Int32)), Pointer(Foo(Int32) | Pointer(Foo(Int32))), ...
x = 1
x = {pointerof(x)} # Error: recursive pointerof expansion: Pointer(Int32), Pointer(Int32 | Tuple(Pointer(Int32))), ...
class Foo(*T); end

x = 1
y = pointerof(x)
x = Foo(String).new # okay

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:generics labels Feb 8, 2022
@beta-ziliani beta-ziliani added this to the 1.4.0 milestone Mar 18, 2022
@straight-shoota straight-shoota merged commit 9d42033 into crystal-lang:master Mar 21, 2022
@HertzDevil HertzDevil deleted the bug/pointerof-generic-splat branch March 21, 2022 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:generics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite recursion with pointerof of generic splat type variables.
3 participants