mirror of
https://github.com/enso-org/enso.git
synced 2024-11-25 21:25:20 +03:00
Allow (42 : Text & Integer) at the end of function (#11588)
Bypassing failing check.
This commit is contained in:
parent
1a5b194f51
commit
9b1f2efbfe
@ -318,7 +318,7 @@ case object TypeSignatures extends IRPass {
|
||||
case a => Some(resolveExpression(a))
|
||||
} ::: lastSignature
|
||||
.map({
|
||||
case asc @ Type.Ascription(_: Name, sig, comment, _, _) =>
|
||||
case asc @ Type.Ascription(_, sig, comment, _, _) =>
|
||||
asc.updateMetadata(
|
||||
new MetadataPair(this, Signature(sig, comment))
|
||||
)
|
||||
|
@ -1026,6 +1026,30 @@ public class SignatureTest extends ContextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnTypeCheckByLastStatementOfMain() throws Exception {
|
||||
final URI uri = new URI("memory://rts.enso");
|
||||
final Source src =
|
||||
Source.newBuilder(
|
||||
"enso",
|
||||
"""
|
||||
from Standard.Base import all
|
||||
|
||||
fn =
|
||||
(42 : Text & Integer)
|
||||
|
||||
Text.from (that:Integer) = that.to_text
|
||||
""",
|
||||
uri.getAuthority())
|
||||
.uri(uri)
|
||||
.buildLiteral();
|
||||
|
||||
var module = ctx.eval(src);
|
||||
var main = module.invokeMember(MethodNames.Module.EVAL_EXPRESSION, "fn");
|
||||
assertEquals(42, main.asInt());
|
||||
assertEquals("42", main.asString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar scenario to {@code returnTypeCheckOptInError}, but with the opt out signature the check
|
||||
* is not currently performed.
|
||||
|
Loading…
Reference in New Issue
Block a user