Skip to content

Commit

Permalink
Also check intersection type
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jun 11, 2024
1 parent 9cf8153 commit eaadc7f
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.enso.interpreter.test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -307,4 +309,28 @@ public void simpleAnyOrACheck() {

assertEquals("A", create.getMetaObject().getMetaSimpleName());
}

@Test
public void intersectionAnyOrACheck() {
var code =
"""
import Standard.Base.Any.Any
type A
Typed (x:Any&A)
t = ..Typed ..My_Other
materialize v:A = v
create = materialize t
""";

try {
var create =
ctx.eval("enso", code).invokeMember(MethodNames.Module.EVAL_EXPRESSION, "create");
fail("Got value, but expecting an exception: " + create);
} catch (PolyglotException ex) {
assertThat(ex.getMessage(), containsString("Cannot find constructor ..My_Other among A."));
}
}
}

0 comments on commit eaadc7f

Please sign in to comment.