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

Fixes Crystal 1.13 regression issue #89

Merged
merged 5 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
crystal_version: [latest]
experimental: [false]
include:
- os: ubuntu-latest
crystal_version: 1.4.0
experimental: false
- os: ubuntu-latest
crystal_version: nightly
experimental: true
runs-on: ${{ matrix.os }}
continue-on-error: false
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v3
- uses: crystal-lang/install-crystal@v1
Expand Down
4 changes: 2 additions & 2 deletions src/habitat.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Habitat
{% for type in TYPES_WITH_HABITAT %}
{% for setting in type.constant(:HABITAT_SETTINGS) %}
{% if !setting[:decl].type.is_a?(Union) ||
(setting[:decl].type.is_a?(Union) && !setting[:decl].type.types.map(&.id).includes?(Nil.id)) %}
(setting[:decl].type.is_a?(Union) && !setting[:decl].type.types.any?(&.names.includes?(Nil.id))) %}
if {{ type }}.settings.{{ setting[:decl].var }}?.nil?
raise MissingSettingError.new {{ type }}, setting_name: {{ setting[:decl].var.stringify }}, example: {{ setting[:example] }}
end
Expand Down Expand Up @@ -231,7 +231,7 @@ class Habitat
# NOTE: We can't use the macro level `type.resolve.nilable?` here because
# there's a few declaration types that don't respond to it which would make the logic
# more complex. Metaclass, and Proc types are the main, but there may be more.
{% if decl.type.is_a?(Union) && decl.type.types.map(&.id).includes?(Nil.id) %}
{% if decl.type.is_a?(Union) && decl.type.types.any?(&.names.includes?(Nil.id)) %}
{% nilable = true %}
{% else %}
{% nilable = false %}
Expand Down
Loading