Skip to content

Commit

Permalink
Simple test case for PartialTypeVar (#308)
Browse files Browse the repository at this point in the history
* Add test case for PartialTypeVar

* Bump patch

* Thanks for Jameson

* Loosen perf for Core._svec_ref test

* Loosen Core.apply_type perf range
  • Loading branch information
willtebbutt authored Oct 22, 2024
1 parent c58457f commit 4b28eb9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Mooncake"
uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
authors = ["Will Tebbutt, Hong Ge, and contributors"]
version = "0.4.20"
version = "0.4.21"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
6 changes: 3 additions & 3 deletions src/rrules/builtins.jl
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ function generate_hand_written_rrule!!_test_cases(rng_ctor, ::Val{:builtins})
# Core._primitivetype -- NEEDS IMPLEMENTING AND TESTING
# Core._setsuper! -- NEEDS IMPLEMENTING AND TESTING
# Core._structtype -- NEEDS IMPLEMENTING AND TESTING
(false, :none, nothing, Core._svec_ref, svec(5, 4), 2),
(false, :none, _range, Core._svec_ref, svec(5, 4), 2),
# Core._typebody! -- NEEDS IMPLEMENTING AND TESTING
(false, :stability, nothing, <:, Float64, Int),
(false, :stability, nothing, <:, Any, Float64),
Expand All @@ -799,8 +799,8 @@ function generate_hand_written_rrule!!_test_cases(rng_ctor, ::Val{:builtins})
(false, :stability, nothing, ===, randn(5), randn(3)),
(false, :stability, nothing, ===, 5.0, 5.0),
(true, :stability, nothing, Core._typevar, :T, Union{}, Any),
(false, :none, (lb=1e-3, ub=100.0), Core.apply_type, Vector, Float64),
(false, :none, (lb=1e-3, ub=100.0), Core.apply_type, Array, Float64, 2),
(false, :none, _range, Core.apply_type, Vector, Float64),
(false, :none, _range, Core.apply_type, Array, Float64, 2),
# Core.compilerbarrier -- NEEDS IMPLEMENTING AND TESTING
# Core.const_arrayref -- NEEDS IMPLEMENTING AND TESTING
# Core.donotdelete -- NEEDS IMPLEMENTING AND TESTING
Expand Down
5 changes: 5 additions & 0 deletions src/test_resources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@ function non_const_global_ref(y::Float64)
return __x_for_non_const_global_ref
end

# The inferred type of `TypeVar(...)` is `CC.PartialTypeVar`. Thanks to Jameson Nash for
# pointing out this pleasantly simple test case.
partial_type_var() = TypeVar(:a, Union{}, Any)

function generate_test_functions()
return Any[
(false, :allocs, nothing, const_tester),
Expand Down Expand Up @@ -738,6 +742,7 @@ function generate_test_functions()
(false, :allocs, nothing, inlinable_invoke_call, 5.0),
(false, :none, nothing, inlinable_vararg_invoke_call, (2, 2), 5.0, 4.0, 3.0, 2.0),
(false, :none, nothing, hvcat, (2, 2), 3.0, 2.0, 0.0, 1.0),
(false, :none, nothing, partial_type_var),
]
end

Expand Down

2 comments on commit 4b28eb9

@willtebbutt
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/117811

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.21 -m "<description of version>" 4b28eb99b7643c570e2dcdc3d8c7891907b39e1c
git push origin v0.4.21

Please sign in to comment.