diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 663ad7bcea6e..29ab2f6946c7 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -16,12 +16,6 @@ jobs: strategy: matrix: crystal_bootstrap_version: [1.2.2, 1.3.2, 1.4.1, 1.5.1, 1.6.2, 1.7.0] - include: - # libffi is only available starting from the 1.2.2 build images - - crystal_bootstrap_version: 1.0.0 - flags: -Dwithout_ffi - - crystal_bootstrap_version: 1.1.1 - flags: -Dwithout_ffi steps: - name: Download Crystal source uses: actions/checkout@v3 diff --git a/spec/std/float_spec.cr b/spec/std/float_spec.cr index b93597c389c6..a9316e888b4a 100644 --- a/spec/std/float_spec.cr +++ b/spec/std/float_spec.cr @@ -327,25 +327,21 @@ describe "Float" do (-0.0/0.0).finite?.should be_false end - {% if compare_versions(Crystal::VERSION, "0.36.1") > 0 %} - it "converts infinity" do - Float32::INFINITY.to_f64.infinite?.should eq 1 - Float32::INFINITY.to_f32.infinite?.should eq 1 - expect_raises(OverflowError) { Float32::INFINITY.to_i } - (-Float32::INFINITY).to_f64.infinite?.should eq -1 - (-Float32::INFINITY).to_f32.infinite?.should eq -1 - expect_raises(OverflowError) { (-Float32::INFINITY).to_i } - - Float64::INFINITY.to_f64.infinite?.should eq 1 - Float64::INFINITY.to_f32.infinite?.should eq 1 - expect_raises(OverflowError) { Float64::INFINITY.to_i } - (-Float64::INFINITY).to_f64.infinite?.should eq -1 - (-Float64::INFINITY).to_f32.infinite?.should eq -1 - expect_raises(OverflowError) { (-Float64::INFINITY).to_i } - end - {% else %} - pending "converts infinity" - {% end %} + it "converts infinity" do + Float32::INFINITY.to_f64.infinite?.should eq 1 + Float32::INFINITY.to_f32.infinite?.should eq 1 + expect_raises(OverflowError) { Float32::INFINITY.to_i } + (-Float32::INFINITY).to_f64.infinite?.should eq -1 + (-Float32::INFINITY).to_f32.infinite?.should eq -1 + expect_raises(OverflowError) { (-Float32::INFINITY).to_i } + + Float64::INFINITY.to_f64.infinite?.should eq 1 + Float64::INFINITY.to_f32.infinite?.should eq 1 + expect_raises(OverflowError) { Float64::INFINITY.to_i } + (-Float64::INFINITY).to_f64.infinite?.should eq -1 + (-Float64::INFINITY).to_f32.infinite?.should eq -1 + expect_raises(OverflowError) { (-Float64::INFINITY).to_i } + end it "does unary -" do f = -(1.5) diff --git a/spec/std/number_spec.cr b/spec/std/number_spec.cr index 0b703d7199d0..b517c3cc7cb8 100644 --- a/spec/std/number_spec.cr +++ b/spec/std/number_spec.cr @@ -69,20 +69,16 @@ describe "Number" do (-Float64::INFINITY).round(digits: -3).should eq -Float64::INFINITY end - {% if compare_versions(Crystal::VERSION, "0.36.1") > 0 %} - it "infinity Float32" do - Float32::INFINITY.round.should eq Float32::INFINITY - Float32::INFINITY.round(digits: 0).should eq Float32::INFINITY - Float32::INFINITY.round(digits: 3).should eq Float32::INFINITY - Float32::INFINITY.round(digits: -3).should eq Float32::INFINITY - (-Float32::INFINITY).round.should eq -Float32::INFINITY - (-Float32::INFINITY).round(digits: 0).should eq -Float32::INFINITY - (-Float32::INFINITY).round(digits: 3).should eq -Float32::INFINITY - (-Float32::INFINITY).round(digits: -3).should eq -Float32::INFINITY - end - {% else %} - pending "infinity Float32" - {% end %} + it "infinity Float32" do + Float32::INFINITY.round.should eq Float32::INFINITY + Float32::INFINITY.round(digits: 0).should eq Float32::INFINITY + Float32::INFINITY.round(digits: 3).should eq Float32::INFINITY + Float32::INFINITY.round(digits: -3).should eq Float32::INFINITY + (-Float32::INFINITY).round.should eq -Float32::INFINITY + (-Float32::INFINITY).round(digits: 0).should eq -Float32::INFINITY + (-Float32::INFINITY).round(digits: 3).should eq -Float32::INFINITY + (-Float32::INFINITY).round(digits: -3).should eq -Float32::INFINITY + end it "nan" do Float64::NAN.round.nan?.should be_true diff --git a/src/compiler/crystal.cr b/src/compiler/crystal.cr index e6924d4d5248..884c0eed50bc 100644 --- a/src/compiler/crystal.cr +++ b/src/compiler/crystal.cr @@ -3,6 +3,11 @@ {% raise("Please use `make crystal` to build the compiler, or set the i_know_what_im_doing flag if you know what you're doing") unless env("CRYSTAL_HAS_WRAPPER") || flag?("i_know_what_im_doing") %} +{% + version = "1.2.0" + raise("Compiling Crystal requires at least version #{version.id} of Crystal. Current version is #{Crystal::VERSION}") if compare_versions(Crystal::VERSION, version.id) < 0 +%} + require "log" require "./requires" diff --git a/src/indexable/mutable.cr b/src/indexable/mutable.cr index 86331554f924..3d2fef37b192 100644 --- a/src/indexable/mutable.cr +++ b/src/indexable/mutable.cr @@ -213,7 +213,6 @@ module Indexable::Mutable(T) end end - {% begin %} # Invokes the given block for each element of `self`, replacing the element # with the value returned by the block. Returns `self`. # @@ -222,17 +221,12 @@ module Indexable::Mutable(T) # a.map! { |x| x * x } # a # => [1, 4, 9] # ``` - {% if compare_versions(Crystal::VERSION, "1.1.1") >= 0 %} def map!(& : T -> _) : self # TODO: add as constant - {% else %} - def map!(&) # it doesn't compile with the type annotation in the 1.0.0 compiler - {% end %} each_index do |i| unsafe_put(i, yield unsafe_fetch(i)) end self end - {% end %} # Like `#map!`, but the block gets passed both the element and its index. # diff --git a/src/unicode/unicode.cr b/src/unicode/unicode.cr index 6a9a7698c3d4..5f630445ea83 100644 --- a/src/unicode/unicode.cr +++ b/src/unicode/unicode.cr @@ -132,21 +132,12 @@ module Unicode array << value end - # TODO: remove the workaround for 1.0.0 eventually (needed until #10713) private macro dfa_state(*transitions) - {% if compare_versions(Crystal::VERSION, "1.1.0") >= 0 %} - {% x = 0_u64 %} - {% for tr, i in transitions %} - {% x |= (1_u64 << (i * 6)) * tr * 6 %} - {% end %} - {{ x }} - {% else %} - {% x = [] of Nil %} - {% for tr, i in transitions %} - {% x << "(#{tr * 6}_u64 << #{i * 6})" %} - {% end %} - {{ x.join(" | ").id }} + {% x = 0_u64 %} + {% for tr, i in transitions %} + {% x |= (1_u64 << (i * 6)) * tr * 6 %} {% end %} + {{ x }} end # :nodoc: