mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Workaround for NoReturn type for block
Not sure if this will work for everything. It seems that NoReturn shows up as ReturnType (generic) when the compiler detects the block will raise.
This commit is contained in:
parent
c47b47ade9
commit
8fc3af075c
1 changed files with 12 additions and 2 deletions
|
@ -15,7 +15,12 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create(proc : -> T, label : String) forall T
|
def self.create(proc : -> T, label : String) forall T
|
||||||
TestBlock(T).new(proc, label)
|
{% if T.id == "ReturnType".id %}
|
||||||
|
wrapper = -> { proc.call; nil }
|
||||||
|
TestBlock(Nil).new(wrapper, label)
|
||||||
|
{% else %}
|
||||||
|
TestBlock(T).new(proc, label)
|
||||||
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates the block expression with a generic label.
|
# Creates the block expression with a generic label.
|
||||||
|
@ -25,7 +30,12 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create(proc : -> T) forall T
|
def self.create(proc : -> T) forall T
|
||||||
TestBlock(T).new(proc)
|
{% if T.id == "ReturnType".id %}
|
||||||
|
wrapper = -> { proc.call; nil }
|
||||||
|
TestBlock(Nil).new(wrapper)
|
||||||
|
{% else %}
|
||||||
|
TestBlock(T).new(proc)
|
||||||
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Reports complete information about the expression.
|
# Reports complete information about the expression.
|
||||||
|
|
Loading…
Reference in a new issue