diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/AutoscopedConstructorTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/AutoscopedConstructorTest.java index 73d6e841fbf1..41515e2c0e82 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/AutoscopedConstructorTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/AutoscopedConstructorTest.java @@ -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; @@ -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.")); + } + } }