Merge pull request #4567 from joshuawarner32/tuple-type-annotation

Implement tuple type parsing
This commit is contained in:
Ayaz 2022-11-24 14:42:11 -06:00 committed by GitHub
commit 848c18f996
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 721 additions and 69 deletions

View file

@ -2907,6 +2907,27 @@ fn to_tinparens_report<'a>(
}
}
ETypeInParens::Empty(pos) => {
let surroundings = Region::new(start, pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
let doc = alloc.stack([
alloc.reflow("I am partway through parsing a parenthesized type:"),
alloc.region_with_subregion(lines.convert_region(surroundings), region),
alloc.concat([
alloc.reflow(r"I was expecting to see an expression next."),
alloc.reflow(r"Note, Roc doesn't use '()' as a null type."),
]),
]);
Report {
filename,
doc,
title: "EMPTY PARENTHESES".to_string(),
severity: Severity::RuntimeError,
}
}
ETypeInParens::End(pos) => {
let surroundings = Region::new(start, pos);
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));