-
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 interface elaboration when %unbound_implicits is off #3052
Conversation
64b4684
to
451e888
Compare
I don't think that's appropriate: %unbound_implicits off
interface {0 a : Type} -> Foo a where
interface {0 a : Type} -> Foo a => Bar a where |
I had tried that, and I thouht that would be more consistent with Here they are added to the data type: Idris2/src/Idris/Elab/Interface.idr Lines 448 to 450 in 86c53e6
And to the top level methods: Idris2/src/Idris/Elab/Interface.idr Line 192 in 86c53e6
with a note down here: Idris2/src/Idris/Elab/Interface.idr Lines 213 to 218 in 86c53e6
Adding those implicits up front, we could have the type of interface {0 a : Type} -> Foo (a : Type -> Type) where So I had figured in for a penny, in for a pound, and have Currently params are added to the top level methods (see above) and the data type. Constraints (and only constraints) rely on unbound implicits. And they're added and then removed from the method declaration within the data (presumably because the data already has them up front): Idris2/src/Idris/Elab/Interface.idr Lines 213 to 218 in 86c53e6
If we want to add that syntax, we need to decide how it interacts with the |
This PR's changelog entry will likely end up under the v0.7.0 heading unintentionally if git is left to its own devices. |
Description
A user on discord reported problems defining interfaces with constraints if unbound_implicits is disabled. The error was undefined names on the type of the
Constraint
that was being generated. The missing names are always the parameters of the interface (because the interface with parameters is part of the type), so I implicitly pi-bind in all of the parameters. This is also done in the existing code when generating the type for the data.Prior to the fix the following code:
reports the error
with the patch we get no error.
Should this change go in the CHANGELOG?
implementation, I have updated
CHANGELOG.md
(and potentially alsoCONTRIBUTORS.md
).