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

Sementic: prevent infinity recursion by alias and generics combination #5330

Conversation

makenowjust
Copy link
Contributor

Fixed #5329

See comments in source code. Thank you.

@@ -667,7 +667,10 @@ module Crystal
elsif context.strict?
type_var == other_type_var
else
type_var.restrict(other_type_var, context) == type_var
# To prevent infinity recursion, it checks equality between
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something that reaches "infinity" is "infinite", it has no "finite" amount ;)

@@ -297,4 +297,17 @@ describe "Semantic: alias" do
),
"undefined constant T"
end

it "doesn't crash by infinity recustion against type alias and generics (#5329)" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: recustion should be recursion.

Thank you @jhass and @lachlan.
@RX14 RX14 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Nov 28, 2017
@RX14 RX14 added this to the Next milestone Nov 28, 2017
@RX14 RX14 merged commit 7033082 into crystal-lang:master Nov 28, 2017
@makenowjust makenowjust deleted the fix/crystal/5329-prevent-alias-and-generics-infinity-recursion branch November 28, 2017 14:12
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants