Skip to content

Conversation

@aviatesk
Copy link
Member

@aviatesk aviatesk commented May 1, 2024

So that it can be concrete-evaluated.

Comment on lines +80 to +85
for T = Base.uniontypes(Union{Base.Checked.SignedInt,Base.Checked.UnsignedInt})
@testset let T = T
@test factorial(T(7)) == 5040
@test Core.Compiler.is_foldable(Base.infer_effects(factorial, (T,)))
end
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for T = Base.uniontypes(Union{Base.Checked.SignedInt,Base.Checked.UnsignedInt})
@testset let T = T
@test factorial(T(7)) == 5040
@test Core.Compiler.is_foldable(Base.infer_effects(factorial, (T,)))
end
end
types = Base.uniontypes(Union{Base.Checked.SignedInt,Base.Checked.UnsignedInt})
@testset for T = types
@test factorial(T(7)) == 5040
@test Core.Compiler.is_foldable(Base.infer_effects(factorial, (T,)))
end

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer the contextual testset.

Copy link
Contributor

@Seelengrab Seelengrab May 1, 2024

Choose a reason for hiding this comment

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

The @testset for will also show the iterated object as context on a failure, but aggregated and not as individual testsets:

julia> using Test

julia> types = Base.uniontypes(Union{Base.Checked.SignedInt,Base.Checked.UnsignedInt});

julia> @testset begin
       @testset for T = types
           @test factorial(T(7)) == 5040
           @test Core.Compiler.is_foldable(Base.infer_effects(factorial, (T,)))
       end
       end

[...]
Test Summary: | Pass  Fail  Total  Time
test set      |   10    10     20  0.4s
  T = Int128  |    1     1      2  0.0s
  T = Int16   |    1     1      2  0.0s
  T = Int32   |    1     1      2  0.0s
  T = Int64   |    1     1      2  0.0s
  T = Int8    |    1     1      2  0.0s
  T = UInt128 |    1     1      2  0.0s
  T = UInt16  |    1     1      2  0.0s
  T = UInt32  |    1     1      2  0.0s
  T = UInt64  |    1     1      2  0.0s
  T = UInt8   |    1     1      2  0.0s
ERROR: Some tests did not pass: 10 passed, 10 failed, 0 errored, 0 broken.

(run on a ~month old master, hence the failures)

So that it can be concrete-evaluated.
@aviatesk aviatesk force-pushed the avi/factorial-effects branch from 96993af to abed954 Compare May 1, 2024 13:15
@aviatesk aviatesk merged commit c0ce76c into master May 2, 2024
@aviatesk aviatesk deleted the avi/factorial-effects branch May 2, 2024 09:12
lazarusA pushed a commit to lazarusA/julia that referenced this pull request Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants