Skip to content

Commit

Permalink
Ascriptions in type constructors shall be checked as well
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed May 5, 2023
1 parent 1cdb009 commit e4a3cd4
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,25 @@ public void wrongAscribedTypeSignature() throws Exception {
assertTrue("It is a syntax error exception", e.isSyntaxError());
}
}

@Test
public void wrongAscribedInConstructor() throws Exception {
final URI uri = new URI("memory://constructor.enso");
final Source src = Source.newBuilder("enso", """
type Neg
Val (a : Xyz)
neg = Neg.Val 10
""", uri.getHost())
.uri(uri)
.buildLiteral();

try {
var module = ctx.eval(src);
var neg = module.invokeMember("eval_expression", "neg");
fail("Expecting an exception from compilation, not: " + neg);
} catch (PolyglotException e) {
assertTrue("It is a syntax error exception", e.isSyntaxError());
}
}
}

0 comments on commit e4a3cd4

Please sign in to comment.