-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fixing Crystal 1.13 regression issues #1900
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dependencies: | ||
habitat: | ||
github: luckyframework/habitat | ||
branch: main |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,9 @@ module Lucky::Assignable | |
{% sorted_assigns = ASSIGNS.sort_by { |dec| | ||
has_explicit_value = | ||
dec.type.is_a?(Metaclass) || | ||
dec.type.types.map(&.id).includes?(Nil.id) || | ||
dec.type.types.any? { |t| | ||
(t.is_a?(Metaclass) || t.is_a?(ProcNotation) || t.is_a?(Generic)) ? false : t.names.includes?(Nil.id) | ||
} || | ||
!dec.value.is_a?(Nop) | ||
has_explicit_value ? 1 : 0 | ||
} %} | ||
|
@@ -98,7 +100,7 @@ module Lucky::Assignable | |
{% var = declaration.var %} | ||
{% type = declaration.type %} | ||
{% value = declaration.value %} | ||
{% value = nil if type.stringify.ends_with?("Nil") && !value %} | ||
{% value = nil if type.stringify.ends_with?("Nil") && value.nil? %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed this because if for some reason you did |
||
@{{ var.id }} : {{ type }}{% if !value.is_a?(Nop) %} = {{ value }}{% end %}, | ||
{% end %} | ||
**unused_exposures | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,7 +260,7 @@ module Lucky::Routable | |
end | ||
|
||
{% params_with_defaults = PARAM_DECLARATIONS.select do |decl| | ||
!decl.value.is_a?(Nop) || decl.type.is_a?(Union) && decl.type.types.last.id == Nil.id | ||
!decl.value.is_a?(Nop) || decl.type.is_a?(Union) && decl.type.resolve.nilable? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here |
||
end %} | ||
{% params_without_defaults = PARAM_DECLARATIONS.reject do |decl| | ||
params_with_defaults.includes? decl | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of doing this, but if we use
type.resolve
here we will have to force all Lucky apps to start adding a bunch ofrequire
statements at the top of all the files because of examples like..This starts to compound when you're talking about hundreds of actions, models, queries, operations, pages, etc...