···117117 EmptyGuardBlock,
118118 // When the use tries to define a constant inside a function
119119 ConstantInsideFunction,
120120+ FunctionDefinitionAngleGenerics, // fn something<T>() { ... }
120121}
121122122123pub(crate) struct ParseErrorDetails {
···649650 "Either move this into the global scope or use `let` binding instead.".into(),
650651 ),
651652 label_text: "Constants are not allowed inside functions".into(),
653653+ extra_labels: vec![],
654654+ },
655655+656656+ ParseErrorType::FunctionDefinitionAngleGenerics => ParseErrorDetails {
657657+ text: "\
658658+Generic function type variables do not need to be predeclared like they
659659+would be in some other languages, instead they are written with lowercase
660660+names.
661661+662662+ fn example(argument: generic) -> generic
663663+664664+See: https://tour.gleam.run/functions/generic-functions/"
665665+ .into(),
666666+ hint: None,
667667+ label_text: "I was expecting `(` here.".into(),
652668 extra_labels: vec![],
653669 },
654670 }
···11+---
22+source: compiler-core/src/parse/tests.rs
33+expression: "fn id<T>(x: T) { x }"
44+---
55+----- SOURCE CODE
66+fn id<T>(x: T) { x }
77+88+----- ERROR
99+error: Syntax error
1010+ ┌─ /src/parse/error.gleam:1:6
1111+ │
1212+1 │ fn id<T>(x: T) { x }
1313+ │ ^ I was expecting `(` here.
1414+1515+Generic function type variables do not need to be predeclared like they
1616+would be in some other languages, instead they are written with lowercase
1717+names.
1818+1919+ fn example(argument: generic) -> generic
2020+2121+See: https://tour.gleam.run/functions/generic-functions/