-
Notifications
You must be signed in to change notification settings - Fork 339
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
Open goal inside record causes internal error (eta-contraction) #5478
Comments
The error already occurs with record ⊤ : Set where
record R : Set₁ where
foo : ⊤
foo = ? -- works with _ instead of ?
field X : Set |
Bisection says: 56c804c is the first bad commit.
(Patch comprises 14 changed files with 380 additions and 97 deletions - sigh...) UPDATE: This patch isn't the problem, maybe it exposed the problem, or it is a false alarm. |
It seems like the crashing eta-reduction happens during this agda/src/full/Agda/TypeChecking/Rules/Def.hs Line 342 in 8e4a198
It is called on foo r = _1 r and I supposed _1 := record{} so we end up with the ill-formed record{} r .I suppose when the meta is created during computing the type of the constructor (hello #434) there is no record variable r in the context, but when we check the declaration foo there is. This would explain why the problem does not surface with _ instead of ? . With an interaction meta, we are trying to not create two metas (one an in each path), and instead reuse the meta created on the first run-through, which happens to be created in a context without record variable r .
|
I suppose the heuristics here: agda/src/full/Agda/TypeChecking/MetaVars.hs Lines 365 to 375 in 8e4a198
blows up in this case. We need to use a meta-variable created in one context (without the r variable) in an extended extension (with the r variable)? Is this something we can do with checkpoints @jespercockx @UlfNorell ?
|
An interaction meta might be created in a context with one binding for each record field, but then reused in a context with just a single binding of the record variable. This patch tries to correctly instantiate the original meta (created during the constructor type construction run) when used during a second type-checking run (this time, the record declarations).
Introduce dependencies, giving it more opportunities to fail...
Introduce dependencies, giving it more opportunities to fail...
An interaction meta might be created in a context with one binding for each record field, but then reused in a context with just a single binding of the record variable. This patch tries to correctly instantiate the original meta (created during the constructor type construction run) when used during a second type-checking run (this time, the record declarations).
Introduce dependencies, giving it more opportunities to fail...
An interaction meta might be created in a context with one binding for each record field, but then reused in a context with just a single binding of the record variable. This patch tries to correctly instantiate the original meta (created during the constructor type construction run) when used during a second type-checking run (this time, the record declarations).
While #5483 fixed my shrunk MWE, the OP still produces an internal error (but a new one): record R3 (A : Set) (B : A → Set) : Set₁ where
instance
bR1 : {a : A} → R1 (B a)
bR1 = {!!}
It seems that on the first pass, Agda did not insert the hidden binding |
Introduce dependencies, giving it more opportunities to fail...
An interaction meta might be created in a context with one binding for each record field, but then reused in a context with just a single binding of the record variable. This patch tries to correctly instantiate the original meta (created during the constructor type construction run) when used during a second type-checking run (this time, the record declarations).
The following code produces an internal error:
If the goal of
bR1
is replaced withrecord {}
then the code type checks. This error occurred with Agda versions 2.6.2 and master branch at commit 23e07c0.The text was updated successfully, but these errors were encountered: