Skip to content

Commit 4f5991c

Browse files
AaronC81lpil
authored andcommitted
Add CHANGELOG entry for angle-bracket generic errors
1 parent 465a5d4 commit 4f5991c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,27 @@
147147
is now smaller in certain cases.
148148
([Surya Rose](https://github.com/GearsDatapacks))
149149

150+
- The compiler now shows a specific syntax error when trying to use an
151+
angle-bracket syntax for generic types or function definitions:
152+
153+
```txt
154+
error: Syntax error
155+
┌─ /src/parse/error.gleam:1:6
156+
157+
1 │ fn id<T>(x: T) { x }
158+
│ ^ I was expecting `(` here.
159+
160+
If you were trying to define a generic function, Gleam does not use angle brackets.
161+
Instead, you should write types in the parameter list with lower-case names.
162+
Each unique lower-case name becomes a type variable:
163+
164+
fn example(arg: t) -> t
165+
166+
See: https://tour.gleam.run/functions/generic-functions/
167+
```
168+
169+
([Aaron Christiansen](https://github.com/AaronC81))
170+
150171
### Build tool
151172

152173
- New projects are generated using OTP28 on GitHub Actions.

0 commit comments

Comments
 (0)