reasonml/reason-native

Failure to parse polymorphic variant outputs:

jordwalke opened this issue · 0 comments

If you have code like:

let x : [`Foo] = `Bar;

The unformatted output will look something like:

File "bin/ReffectsApp.re", line 4, characters 17-21:
Error: This expression has type [> `Bar ]
       but an expression was expected of type [ `Foo ]
       The second variant type does not allow tag(s) `Bar

But the polymorphic variants seem to be tripping up the parsing. But the more concerning part is that it seems to be attempting to execute part of the output in my shell!

      ocamlc bin/.ReffectsApp.eobjs/byte/ReffectsApp.{cmi,cmo,cmt} (exit 2)
(cd /media/sdb1/Reffects/_esy/default/store/b/reffects-134e563c/default && /root/.esy/3/i/ocaml-4.7.1004-a6ae015e/bin/ocamlc.opt -open ReffectsBinPesyModules -g -bin-annot -I bin/.ReffectsApp.eobjs/byte -I /root/.esy/3/i/opam__s__re-opam__c__1.9.0-d905ca90/lib/re -I /root/.esy/3/i/opam__s__seq-opam__c__base-37652505/lib/seq -I /root/.esy/3/i/reason_native__s__console-0.1.0-ab1c2a94/lib/console/lib -I /root/.esy/3/i/reason_native__s__pastel-0.3.0-045d18ca/lib/pastel/internal -I /root/.esy/3/i/reason_native__s__pastel-0.3.0-045d18ca/lib/pastel/lib -I bin/.ReffectsBinPesyModules.objs/byte -I bin/.ReffectsBinPesyModules.objs/native -I library/.ReffectsLibrary.objs/byte -I library/.ReffectsLibrary.objs/native -I library/.ReffectsLibraryPesyModules.objs/byte -I library/.ReffectsLibraryPesyModules.objs/native -no-alias-deps -o bin/.ReffectsApp.eobjs/byte/ReffectsApp.cmo -c -impl bin/ReffectsApp.re.ml)
/bin/sh: line 1: Foo: command not found
/bin/sh: command substitution: line 2: syntax error near unexpected token `('
/bin/sh: command substitution: line 2: `       The second variant type does not allow tag(s) '
/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file
# Unformatted Error Output:
# File "bin/ReffectsApp.re", line 4, characters 17-21:
# Error: This expression has type [> `Bar ]
#        but an expression was expected of type [ `Foo ]
#        The second variant type does not allow tag(s) `Bar


 ERROR  bin/ReffectsApp.re:4 17-21 

  1 ┆ Console.log("Running Test Program:");
  2 ┆ let () = print_endline(Library.Util.hello());
  3 ┆ 
  4 ┆ let x : [`Foo] = `Bar;
  5 ┆ 
  6 ┆ let hello = () =>
  7 ┆   Pastel.(

This type doesn't match what is expected.

  This type: 
  Expecting: ML: [ Bar

I believe it's because we send the types to refmttype command line app, and we apparently do not escape backticks when doing so.