diff --git a/compiler/noirc_frontend/src/parser/parser/types.rs b/compiler/noirc_frontend/src/parser/parser/types.rs index 0de94a89be5..884db763698 100644 --- a/compiler/noirc_frontend/src/parser/parser/types.rs +++ b/compiler/noirc_frontend/src/parser/parser/types.rs @@ -15,7 +15,7 @@ impl<'a> Parser<'a> { typ } else { self.expected_label(ParsingRuleLabel::Type); - self.unspecified_type_at_previous_token_end() + UnresolvedTypeData::Error.with_span(self.span_at_previous_token_end()) } } @@ -660,6 +660,14 @@ mod tests { assert!(unconstrained); } + #[test] + fn parses_function_type_with_colon_in_parameter() { + let src = "fn(value: T) -> Field"; + let mut parser = Parser::for_str(src); + let _ = parser.parse_type_or_error(); + assert!(!parser.errors.is_empty()); + } + #[test] fn parses_trait_as_type_no_generics() { let src = "impl foo::Bar";