Tests for tuple type annotations

This commit is contained in:
greg 2017-09-30 01:14:49 -07:00
parent 9214f36c04
commit 1ae9dbcba7

View File

@ -620,9 +620,7 @@ impl Parser {
parse_method!(type_name(&mut self) -> ParseResult<TypeAnno> {
Ok(match self.peek() {
LParen => {
unimplemented!("Not done with tuple types yet")
},
LParen => TypeAnno::Tuple(delimited!(self, LParen, type_name, Comma, RParen)),
_ => {
let type_name = self.identifier()?;
let params = match self.peek() {
@ -1105,5 +1103,11 @@ mod parse_tests {
ty!("Kimchi"), TypeAnno::Singleton { name: rc!(Option), params: vec![ty!("Bulgogi")] }
] })
]));
parse_test!("a : (Int, Yolo<a>)", AST(vec![
exprstatement!(var!("a"), TypeAnno::Tuple(
vec![ty!("Int"), TypeAnno::Singleton {
name: rc!(Yolo), params: vec![ty!("a")]
}]))]));
}
}