-
Notifications
You must be signed in to change notification settings - Fork 375
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
[ fix ] Fix pattern match issue with function application in Refl #3027
Conversation
The tests The issue is:
which seems a little sketchy. In an actual type declaration, the corresponding type would read |
I've gotten chez007 / node007 to pass by allowing a non-empty, but unmatchable spine. (Matching current behavior.) But the existing behavior in chez007 still seems weird to me. On the LHS descFn : (x : Type) -> String
descFn ((x : Nat) -> b) = descNat (b Z)
descFn (a -> b) = "Function on " ++ desc a
descFn x = desc x |
Unfortunately it's the way it is. I agree it's confusing but currently all matches on |
397f1a7
to
f7e1039
Compare
I have found a regression, cf. test case. |
To fix that regression, I tightened up the cases when this change is applied. I don't know what |
Build failed because main is failing. |
2343303
to
6543675
Compare
There was an odd failure in the windows build, so I merged main to trigger another build. (Is there an easier way to retrigger CI on a branch?) |
Windows test from a previous check-in is failing. I think it's due to not having error handling on the |
It feels like we are piling hacks on top of hacks. I think what we need In the meantime I will merge this because the situation is already broken |
Description
In discord @ohad reported a unification error where a function was being replaced by an application of the same function at type level. A test case that demonstrates the issue is included below. The root cause was that when a
fx = f x
was matched, the implicit argumentfx
in the spine was turned intofx@(f x)
. When this was later processed inmkPat
inCaseBuilder.idr
, the spine was being collected, but inadvertently dropped, so the resulting pattern looked likefx@f
andfx
was later substituted forf
in a function call (note that they have completely different types).The fix is to check for a non-empty spine and fallback to
PUnmatchable
if it's not empty. This results in a pattern that is dotted and includes the arguments:f@(.(f x))
.Consider:
If we comment out
blah
to get it to compile and look at:di foo
in the current version of Idris:The compile time tree is passing
arg:0
tobar
, which is the wrong type. The compiled tree correctly passesarg:2
.Before this change, the code above failed to typecheck with:
After this change the file typechecks.
Should this change go in the CHANGELOG?
implementation, I have updated
CHANGELOG.md
(and potentially alsoCONTRIBUTORS.md
).