Skip to content

Commit 269b555

Browse files
Making sure that Identity and Const can only be constructed with concrete typeparameters
1 parent d88ab03 commit 269b555

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/Const.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ however with additional information about which kind of empty.
66
"""
77
struct Const{T}
88
value::T
9+
Const(value) = new{typeof(value)}(value)
910
end
1011

1112
# == controversy https://github.com/JuliaLang/julia/issues/4648

src/Identity.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ container-abstractions.
99
"""
1010
struct Identity{T}
1111
value::T
12+
Identity(value) = new{typeof(value)}(value)
1213
end
1314
# == controversy https://github.com/JuliaLang/julia/issues/4648
1415
Base.:(==)(a::Identity, b::Identity) = a.value == b.value

0 commit comments

Comments
 (0)