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
Misleading error when using lincat as parameter #35
Comments
The example can be reduced a little bit more:
The root of the problem seems to be the use of the lincat It's the lock fields that are added to lincats that cause problem when you use lincats in this way. They cause problems in
As a quick fix, maybe it's enough to add some code in |
I stumbled upon a similar bug a while ago, but figured that it's such a marginal use case to use lincats in weird ways that I didn't bother to report :-P For curiosity, here it is (sorry it's not even a self-contained example, it was from NounAra.gf): -- Relevant definitions
Agr = NounPer3 {g:Gender ; n:Number} | Pron PerGenNum ;
PN = {s : Case => Str; g : Gender; n : Number} ;
NP = {s : Case => Str ; a = Agr} ;
-- Bug appears here
UsePN pn = {
s = pn.s;
a = NounPer3 pn -- this causes internal error in GeneratePMCFG
-- a = NounPer3 {g=pn.g ; n=pn.n} -- this works
} ; |
Hmm, maybe it is not only lock fields that can cause problems, maybe record subtyping in general can cause problems, in this case a mismatch between records {s,g,n} and {g,n}. Maybe a more elaborate fix is needed… |
Indeed, the problem is in the type checker which is in a very shaky state.
It works for the most common cases but fails as soon as you try something
unconventional. Sub-typing is only one of the things that it doesn't handle
well. Honestly it needs to be replaced completely. I had started this a
while ago but I never got the time and energy to complete it.
…On Tue, 12 Feb 2019 at 15:12, Thomas H ***@***.***> wrote:
Hmm, maybe it is not only lock fields that can cause problems, maybe
record subtyping in general can cause problems, in this case a mismatch
between records {s,g,n} and {g,n}. Maybe a more elaborate fix is needed…
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATBZZPWgYN70emYj50W6Qb_c5oHGRPK4ks5vMsvkgaJpZM4a2CVV>
.
|
Aren't you discussing two different problems here? In Krasimir's example the problem is record subtyping ({s,g,n} vs {g,n}). But in Herbert's and Thomas' examples, the problem is using an abstract category as a linearisation type. Here's a version of Thomas' example that compiles:
(Perhaps both are symptoms of the same bug of course) |
When loading the following Grammar
this error occurs
compiling Test.gf... src/compiler/GF/Compile/GeneratePMCFG.hs:(430,42)-(431,76): Non-exhaustive patterns in case
The text was updated successfully, but these errors were encountered: