From 6dbbf43a91465e866a6e6da0e60e3c3482808a86 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sat, 15 Jun 2024 16:57:58 -0700 Subject: [PATCH 1/3] Overriding Habitat so we can test against Crystal 1.13 fixes --- shard.override.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 shard.override.yml diff --git a/shard.override.yml b/shard.override.yml new file mode 100644 index 000000000..3a871cf1a --- /dev/null +++ b/shard.override.yml @@ -0,0 +1,4 @@ +dependencies: + habitat: + github: luckyframework/habitat + branch: main From 38fc80c712227de11c11ce7ee47c59437f4b313c Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sat, 15 Jun 2024 16:58:19 -0700 Subject: [PATCH 2/3] fixing regression issues for Crystal 1.13. Fixes #1872 --- src/lucky/assignable.cr | 6 ++++-- src/lucky/routable.cr | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lucky/assignable.cr b/src/lucky/assignable.cr index af15a2ba3..e67f7b98c 100644 --- a/src/lucky/assignable.cr +++ b/src/lucky/assignable.cr @@ -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? %} @{{ var.id }} : {{ type }}{% if !value.is_a?(Nop) %} = {{ value }}{% end %}, {% end %} **unused_exposures diff --git a/src/lucky/routable.cr b/src/lucky/routable.cr index e4560dd8b..786b5aafd 100644 --- a/src/lucky/routable.cr +++ b/src/lucky/routable.cr @@ -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? end %} {% params_without_defaults = PARAM_DECLARATIONS.reject do |decl| params_with_defaults.includes? decl From 87148772a87239b639faf5ba2662697839d3de80 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sat, 15 Jun 2024 17:09:05 -0700 Subject: [PATCH 3/3] actually use the shard override to do shard override. probably time to clean up this CI workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5ab78d7c..bf2caaf8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - shard_file: shard.edge.yml crystal_version: latest experimental: true - - shard_file: shard.yml + - shard_file: shard.override.yml crystal_version: nightly experimental: true runs-on: ubuntu-latest