unison/unison-src/transcripts/error-messages.md
2023-01-10 14:33:42 -06:00

1.7 KiB

.> builtins.merge

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

x = 1. -- missing some digits after the decimal
x = 1e -- missing an exponent
x = 1e- -- missing an exponent
x = 1E+ -- missing an exponent

Hex, octal, and bytes literals

x = 0xoogabooga -- invalid hex chars
x = 0o987654321 -- 9 and 8 are not valid octal char
x = 0xsf -- odd number of hex chars in a bytes literal
x = 0xsnotvalidhexchars -- invalid hex chars in a bytes literal

Layout errors

foo = else -- not matching if
foo = then -- unclosed
foo = with -- unclosed

Matching

-- No cases
foo = match 1 with
foo = match 1 with
  2 -- no right-hand-side
-- Mismatched arities
foo = cases
  1, 2 -> ()
  3 -> ()
-- Missing a '->'
x = match Some a with
      None -> 
        1
      Some _
        2
-- Missing patterns
x = match Some a with
      None -> 1
           -> 2
           -> 3
-- Guards following an unguarded case
x = match Some a with
      None     -> 1
        | true -> 2

Watches

-- Empty watch
>

Keywords

use.keyword.in.namespace = 1
-- reserved operator
a ! b = 1