mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 02:21:54 +03:00
shouldCreateClosureRootNode when valueHasSomeTypeCheck (#10262)
Fixes #10236.
This commit is contained in:
parent
0e17beba73
commit
5339484285
@ -2195,10 +2195,13 @@ class IrToTruffle(
|
||||
)
|
||||
.unsafeAs[AliasInfo.Scope.Child]
|
||||
|
||||
def valueHasSomeTypeCheck() =
|
||||
value.getMetadata(TypeSignatures).isDefined
|
||||
|
||||
val shouldCreateClosureRootNode = value match {
|
||||
case _: Name => false
|
||||
case _: Literal.Text => false
|
||||
case _: Literal.Number => false
|
||||
case _: Name => valueHasSomeTypeCheck()
|
||||
case _: Literal.Text => valueHasSomeTypeCheck()
|
||||
case _: Literal.Number => valueHasSomeTypeCheck()
|
||||
case _ => true
|
||||
}
|
||||
|
||||
|
@ -617,6 +617,22 @@ add_specs suite_builder =
|
||||
r = [r1, r2]
|
||||
r.to_text . should_contain "Foo.Value 4"
|
||||
|
||||
group_builder.specify "Convert and catch" <|
|
||||
fn x = x+2
|
||||
|
||||
convert_and_catch x = case x of
|
||||
_:Function ->Panic.catch Any (x:Baz) err->
|
||||
[err, x]
|
||||
_ -> x
|
||||
|
||||
r1 = convert_and_catch 10
|
||||
r2 = convert_and_catch (..Value 13)
|
||||
r3 = convert_and_catch fn
|
||||
|
||||
r1 . should_equal 10
|
||||
r2 . should_equal (Baz.Value 13)
|
||||
r3.to_text . should_contain "expected expression to be Baz, but got"
|
||||
|
||||
suite_builder.group "Polyglot Argument" group_builder->
|
||||
f1 (x : DateTimeFormatter) = x.to_text
|
||||
f2 (x : Text | DateTimeFormatter) = case x of
|
||||
|
Loading…
Reference in New Issue
Block a user