Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to parse polymorphic variant outputs: #238

Open
jordwalke opened this issue Feb 17, 2020 · 0 comments
Open

Failure to parse polymorphic variant outputs: #238

jordwalke opened this issue Feb 17, 2020 · 0 comments

Comments

@jordwalke
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant