2020-11-20 20:53:34 +03:00
```ucm:hide
2024-06-12 01:22:09 +03:00
scratch/main> builtins.merge
2020-11-20 20:53:34 +03:00
```
This file contains programs with parse errors and type errors, for visual inspection of error message quality and to check for regressions or changes to error reporting.
## Parse errors
Some basic errors of literals.
### Floating point literals
```unison:error
x = 1. -- missing some digits after the decimal
```
```unison:error
x = 1e -- missing an exponent
```
```unison:error
x = 1e- -- missing an exponent
```
```unison:error
x = 1E+ -- missing an exponent
```
2024-08-22 16:19:12 +03:00
### Hex, octal, binary, and bytes literals
2020-11-20 20:53:34 +03:00
```unison:error
x = 0xoogabooga -- invalid hex chars
```
```unison:error
x = 0o987654321 -- 9 and 8 are not valid octal char
```
2024-08-21 18:29:54 +03:00
```unison:error
x = 0b3201 -- 3 and 2 are not valid binary chars
```
2020-11-20 20:53:34 +03:00
```unison:error
x = 0xsf -- odd number of hex chars in a bytes literal
```
```unison:error
x = 0xsnotvalidhexchars -- invalid hex chars in a bytes literal
```
### Layout errors
```unison:error
foo = else -- not matching if
```
```unison:error
foo = then -- unclosed
```
```unison:error
foo = with -- unclosed
```
2022-02-17 21:29:24 +03:00
2022-02-17 21:44:22 +03:00
### Matching
2023-01-10 23:33:42 +03:00
```unison:error
-- No cases
foo = match 1 with
```
2022-02-17 21:29:24 +03:00
```unison:error
foo = match 1 with
2 -- no right-hand-side
```
2022-02-17 21:44:22 +03:00
```unison:error
-- Mismatched arities
foo = cases
1, 2 -> ()
3 -> ()
```
2023-01-10 23:33:42 +03:00
```unison:error
-- Missing a '->'
x = match Some a with
2024-08-21 18:29:54 +03:00
None ->
2023-01-10 23:33:42 +03:00
1
Some _
2
```
```unison:error
-- Missing patterns
x = match Some a with
None -> 1
-> 2
-> 3
```
```unison:error
-- Guards following an unguarded case
x = match Some a with
None -> 1
| true -> 2
```
2022-02-17 21:44:22 +03:00
### Watches
```unison:error
-- Empty watch
>
```
2022-02-17 21:29:24 +03:00
### Keywords
```unison:error
use.keyword.in.namespace = 1
```
```unison:error
-- reserved operator
a ! b = 1
```