-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Type checker panic on type alias with type variable #2489
Comments
My guess is that this would work if you instead made the type annotation “Foo b” or “Foo _”. My guess is generalization of “*” is treated specially. This will be another fun (or “fun”) bug ;) @caiquefigueiredo would you be interested in working through this one? |
Just tried it and the panic still happens with both |
noooo |
@ayazhafiz sure! I'm not sure I can go at it alone, but it seems fun :) |
This is one place where the original checker code did not diverge from Elm at all. For whatever reason Elm does not have a problem with this: https://ellie-app.com/hd3JrwdkSD3a1 But I think this is a bug in Elm. Looking further. |
I think this is fine and the panic should just be removed. Posted in Zulip: https://roc.zulipchat.com/#narrow/stream/231635-compiler-development/topic/Can.20rigids.20flow.20out.3F |
Elm has the same problem, but Elle doesn't show it. I'm not sure why. But I hit it in a local build of elm/compiler |
As of 91483db this can be reproduced by adding the following to any
.roc
file and runningroc check
on it:It panics with:
Rigids [116]
Failing [116]
'assertion failed: {\n let failing: Vec<_> =\n rigid_vars.iter().filter(|&var|\n {\n !subs.redundant(*var) &&\n subs.get_rank(*var) != Rank::NONE\n }).collect();\n if !failing.is_empty() {\n println!(\"Rigids {:?}\", & rigid_vars);\n println!(\"Failing {:?}\", failing);\n }\n failing.is_empty()\n}',
compiler/solve/src/solve.rs:572:21
Things that make it no longer crash:
x : Foo *
annotationFoo
annotation\arg ->
lambda (so it's justfoo =
and then thex
def)x =
to something other thanarg
Variations that still reproduce the crash:
Foo a : List a
Foo a : { field : a }
So the relevant part here seems to be the type variable in the alias!
The text was updated successfully, but these errors were encountered: