-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basics * Add inference test * Only run on 1.10 * Add inner constructor * Enable default constructor * Ensure that default constructor works * Add small example in readme * Fix typo * Set to version 1 * Tweak Project.toml
- Loading branch information
1 parent
a2825b6
commit ee52272
Showing
5 changed files
with
56 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,6 @@ jobs: | |
matrix: | ||
version: | ||
- '1.10' | ||
- '1.6' | ||
- 'nightly' | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
module MistyClosures | ||
|
||
# Write your package code here. | ||
using Core: OpaqueClosure | ||
using Core.Compiler: IRCode | ||
|
||
struct MistyClosure{Toc<:OpaqueClosure} | ||
oc::Toc | ||
ir::IRCode | ||
end | ||
|
||
MistyClosure(ir::IRCode; kwargs...) = MistyClosure(OpaqueClosure(ir; kwargs...), ir) | ||
|
||
(mc::MistyClosure)(x::Vararg{Any, N}) where {N} = mc.oc(x...) | ||
|
||
export MistyClosure | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
using MistyClosures | ||
using Test | ||
using MistyClosures, Test | ||
|
||
using Core: OpaqueClosure | ||
|
||
@testset "MistyClosures.jl" begin | ||
# Write your tests here. | ||
ir = Base.code_ircode_by_type(Tuple{typeof(sin), Float64})[1][1] | ||
|
||
# Recommended constructor. | ||
mc = MistyClosure(ir; do_compile=true) | ||
@test @inferred(mc(5.0)) == sin(5.0) | ||
|
||
# Default constructor. | ||
mc_default = MistyClosure(OpaqueClosure(ir; do_compile=true), ir) | ||
@test @inferred(mc_default(5.0) == sin(5.0)) | ||
end |
ee52272
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
ee52272
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
ee52272
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error while trying to register: Register Failed
@willtebbutt, it looks like you are not a publicly listed member/owner in the parent organization (compintell).
If you are a member/owner, you will need to change your membership to public. See GitHub Help
ee52272
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
ee52272
There was a problem hiding this comment.
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/108007
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.
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: