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

unhandled parse error: UnexpectedTopLevelExpr #7188

Open
mcol opened this issue Oct 26, 2024 · 1 comment
Open

unhandled parse error: UnexpectedTopLevelExpr #7188

mcol opened this issue Oct 26, 2024 · 1 comment
Labels
intermediate issue Likely good for someone who has completed a few other issues P-medium Medium priority/frequency

Comments

@mcol
Copy link

mcol commented Oct 26, 2024

I have written this simple program (my first ever in roc):

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }

File.readUtf8 "myfile.txt"

I run it with

RUST_BACKTRACE=full roc build test.roc

I get:

thread 'main' panicked at crates/reporting/src/error/parse.rs:681:14:
not yet implemented: unhandled parse error: UnexpectedTopLevelExpr(@146)
stack backtrace:
   0:     0x59ba19d4b8ab - <unknown>
   1:     0x59ba1900d1e0 - <unknown>
   2:     0x59ba19d47113 - <unknown>
   3:     0x59ba19d4b644 - <unknown>
   4:     0x59ba19d4d1a0 - <unknown>
   5:     0x59ba19d4cebf - <unknown>
   6:     0x59ba19d4d6be - <unknown>
   7:     0x59ba19d4d5c2 - <unknown>
   8:     0x59ba19d4bda6 - <unknown>
   9:     0x59ba19d4d324 - <unknown>
  10:     0x59ba18f02e75 - <unknown>
  11:     0x59ba19aef3e3 - <unknown>
  12:     0x59ba19ae91ef - <unknown>
  13:     0x59ba197730bd - <unknown>
  14:     0x59ba19738d9d - <unknown>
  15:     0x59ba19740b7d - <unknown>
  16:     0x59ba19736bd6 - <unknown>
  17:     0x59ba196d5179 - <unknown>
  18:     0x59ba19217d26 - <unknown>
  19:     0x59ba19333205 - <unknown>
  20:     0x59ba191dcb43 - <unknown>
  21:     0x59ba191cfba3 - <unknown>
  22:     0x59ba191cfbc3 - <unknown>
  23:     0x59ba19d3ce2a - <unknown>
  24:     0x59ba191e25c5 - <unknown>
  25:     0x7ac87de29d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  26:     0x7ac87de29e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  27:     0x59ba18fa06ce - <unknown>
  28:                0x0 - <unknown>

roc nightly pre-release, built from commit 06996d8 on Fr 25 Okt 2024 09:02:07 UTC (on linux x86-64)

@Anton-4 Anton-4 added the P-medium Medium priority/frequency label Oct 28, 2024
@Anton-4
Copy link
Collaborator

Anton-4 commented Oct 28, 2024

Ow, sorry to get you started with an error like this @mcol!
The important thing is that you need to have a main function in your file.
Instead of reading a file, it can be easier to import it like here. If you do prefer to read it the traditional way, check out this example (make sure to switch out "../platform/main.roc" with the basic-cli url).

We should definitely provide a nice error message for this case.

@Anton-4 Anton-4 added the good first issue Good for newcomers label Oct 28, 2024
@Anton-4 Anton-4 changed the title panic + hang unhandled parse error: UnexpectedTopLevelExpr Oct 28, 2024
@Anton-4 Anton-4 added intermediate issue Likely good for someone who has completed a few other issues and removed good first issue Good for newcomers labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intermediate issue Likely good for someone who has completed a few other issues P-medium Medium priority/frequency
Projects
None yet
Development

No branches or pull requests

2 participants