Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn null into UnexpectedExpression when Union type is incomplete #6415

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ IR.Expression translateType(Tree tree, boolean insideTypeAscription) {
}
case Tree.OprApp app -> {
var op = app.getOpr().getRight();
if (op == null) {
yield translateSyntaxError(app, IR$Error$Syntax$UnexpectedExpression$.MODULE$);
}
yield switch (op.codeRepr()) {
case "." -> {
final Option<IdentifiedLocation> loc = getIdentifiedLocation(tree);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ public void malformedImport10() throws Exception {
assertSingleSyntaxError(ir, IR$Error$Syntax$UnexpectedExpression$.MODULE$, "Unexpected expression", 0, 20);
}

@Test
public void malformedTypeException() throws Exception {
var ir = parse("""
fan_out_to_columns : Table -> Text | Integer -> (Any -> Vector Any) -> | Nothing -> Problem_Behavior -> Table | Nothing
""");
assertSingleSyntaxError(ir, IR$Error$Syntax$UnexpectedExpression$.MODULE$, "Unexpected expression", 48, 119);
}

@Test
public void malformedImport11() throws Exception {
var ir = parse("from import all");
Expand Down