ponylang / ponyc

Pony is an open-source, actor-model, capabilities-secure, high performance programming language
http://www.ponylang.io
BSD 2-Clause "Simplified" License
5.71k stars 415 forks source link

Compiler error with exhaustive case within a try #1898

Closed cquinn closed 7 years ago

cquinn commented 7 years ago

With the latest ponyc on master (0.14.0-719e3870 [release]), compiling the following snippet results in a compiler assertion:

class Test
  new create() =>
    try
      match true
      | let b: Bool => return
      end
    end

The assertion looks like:

Building builtin -> /Users/carl/ws/pony/cquinn/ponyc/packages/builtin
Building . -> /Users/carl/ws/pony/cquinn/ponyc/packages/xcli
src/libponyc/pass/expr.c:320: pass_expr: Assertion `errors_get_count(options->check.errors) > 0` failed.

Backtrace:
  0   ponyc                               0x000000010da8e351 ponyint_assert_fail + 161
  1   ponyc                               0x000000010da4c0dd pass_expr + 1037
  2   ponyc                               0x000000010da502ac ast_visit + 300
  3   ponyc                               0x000000010da5026a ast_visit + 234
  4   ponyc                               0x000000010da5026a ast_visit + 234
  5   ponyc                               0x000000010da5026a ast_visit + 234
  6   ponyc                               0x000000010da5026a ast_visit + 234
  7   ponyc                               0x000000010da5026a ast_visit + 234
  8   ponyc                               0x000000010da5026a ast_visit + 234
  9   ponyc                               0x000000010da5026a ast_visit + 234
  10  ponyc                               0x000000010da50ae9 ast_passes + 953
  11  ponyc                               0x000000010da69fc5 program_load + 229
  12  ponyc                               0x000000010d9cca68 main + 1368
  13  libdyld.dylib                       0x00007fffd5a04235 start + 1
This is an optimised version of ponyc: the backtrace may be imprecise or incorrect.
Use a debug version to get more meaningful information.
Abort trap: 6
jemc commented 7 years ago

This will be fixed by #1903 when it is merged.