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

REPL panics on parse errors in transitively imported files #1443

Closed
vkleen opened this issue Jul 11, 2023 · 1 comment
Closed

REPL panics on parse errors in transitively imported files #1443

vkleen opened this issue Jul 11, 2023 · 1 comment

Comments

@vkleen
Copy link
Contributor

vkleen commented Jul 11, 2023

With two files like so:

# foo.ncl
import "bar.ncl"

# bar.ncl
{

that is, foo.ncl immediately imports bar.ncl and bar.ncl contains a parse error, the REPL panics on importing foo.ncl:

nickel> import "foo.ncl"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(ParseErrors(ParseErrors { errors: [UnexpectedEOF(FileId(6), ["\"!\"", "\"\\\"\"", "\"'\\\"\"", "\"(\"", "\"-\"", "\"Array\"", "\"Bool\"", "\"Dyn\"", "\"Number\"", "\"String\"", "\"[\"", "\"[|\"", "\"_\"", "\"array_lazy_assume\"", "\"array_slice\"", "\"assume\"", "\"blame\"", "\"chng_pol\"", "\"deep_seq\"", "\"deserialize\"", "\"dualize\"", "\"elem_at\"", "\"embed\"", "\"enum_from\"", "\"false\"", "\"fields\"", "\"forall\"", "\"fun\"", "\"generate\"", "\"go_array\"", "\"go_codom\"", "\"go_dict\"", "\"go_dom\"", "\"go_field\"", "\"has_field\"", "\"hash\"", "\"identifier\"", "\"if\"", "\"import\"", "\"insert_type_variable\"", "\"label_append_note\"", "\"label_push_diag\"", "\"label_with_message\"", "\"label_with_notes\"", "\"length\"", "\"let\"", "\"lookup_type_variable\"", "\"m%\\\"\"", "\"map\"", "\"match\"", "\"null\"", "\"num literal\"", "\"num_from\"", "\"op force\"", "\"polarity\"", "\"pow\"", "\"raw enum tag\"", "\"rec_default_op\"", "\"rec_force_op\"", "\"record_empty_with_tail\"", "\"record_insert\"", "\"record_lazy_assume\"", "\"record_map\"", "\"record_remove\"", "\"record_seal_tail\"", "\"record_unseal_tail\"", "\"seal\"", "\"seq\"", "\"serialize\"", "\"str_chars\"", "\"str_contains\"", "\"str_find\"", "\"str_from\"", "\"str_is_match\"", "\"str_length\"", "\"str_lowercase\"", "\"str_replace\"", "\"str_replace_regex\"", "\"str_split\"", "\"str_substr\"", "\"str_trim\"", "\"str_uppercase\"", "\"symbolic string start\"", "\"trace\"", "\"true\"", "\"typeof\"", "\"unseal\"", "\"values\"", "\"{\""])] }, Original(RawSpan { src_id: FileId(5), start: ByteIndex(0), end: ByteIndex(16) })))', core/src/repl/mod.rs:116:64

The error message points at the unwrap() call at core/src/repl/mod.rs:116:64. This panic doesn't happen when trying to evaluate foo.ncl from the CLI, or in fact when trying another file that imports foo.ncl.

@yannham yannham added the good first issue Good for newcomers label Jul 11, 2023
jneem referenced this issue Jul 24, 2023
* Add a Types variant to Term

* Mark Types as non-atomic

* Update core/src/term/mod.rs

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Only allow without_pos in tests

* Review comments

* Add a comment

* Improve typechecking of types in contract position

* Add a test for the new error

* Update core/src/eval/mod.rs

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>

* Improve comment

---------

Co-authored-by: Yann Hamdaoui <yann.hamdaoui@tweag.io>
@Radvendii
Copy link
Member

closed in #1474

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

No branches or pull requests

3 participants