postulate
X A : Set
module Foo {{x : X}} where
postulate
B C : Set
foo : A โ B โ C โ Set
module Bar {{x : X}} where
open Foo
postulate
-- The following fails to infer the instance argument if we do not either:
-- * apply {{x}} explicitly to foo
-- * apply {{x}} explicitly when opening module Foo
-- * define fail1 in module Foo
fail1 : โ {a b b' c c'} โ foo a b c โ foo a b' c'
-- However, the following works
work1 : โ {a b c} โ foo a b c โ foo a b c
work2 : โ {a a' b c} โ foo a b c โ foo a' b c
work3 : โ {a b b' c} โ foo a b c โ foo a b' c
work4 : โ {a a' b b' c} โ foo a b c โ foo a' b' c
work5 : โ {a b c c'} โ foo a b c โ foo a b c'
work6 : โ {a a' b c c'} โ foo a b c โ foo a' b c'
work7 : โ {a a' b b' c c'} โ foo a b c โ foo a' b' c'
Tested in Agda version 2.5.1.1 and 2.6.0-989c97c
It looks like the problem is that we lose the instance constraint when the original meta variable is pruned.
What about this one?
data Nat : Set where
suc : Nat โ Nat
instance
zero : Nat
instance
one = suc zero
data IsSuc : Nat โ Set where
isSuc : โ{n} โ IsSuc (suc n)
postulate
F : {{x : Nat}} (p : IsSuc x) โ Set
test = F isSuc -- yellow, but should not be
The instance meta is partially solved by suc _ and the instance constraint is discarded, even though only one instance applies now (one).
For reference, the check for solved metas was introduced in the fix of #1003.
Ah, no one was watching my fingers then... ;-)
Thanks for fixing.