Skip to content
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

Implement overloaded projections #1944

Closed
andreasabel opened this issue Apr 21, 2016 · 2 comments
Closed

Implement overloaded projections #1944

andreasabel opened this issue Apr 21, 2016 · 2 comments
Assignees
Labels
overloading Overloaded projections; Projection disambiguation projections Issues relating to the treatment of projections type: enhancement Issues and pull requests about possible improvements
Milestone

Comments

@andreasabel
Copy link
Member

AIM XXIII code sprint. Milestone 1:

module _ (A : Set) (a : A) where

record R B : Set where
  field f : B
open R

record S B : Set where
  field f : B
open S

r : R A
R.f r = a

s : S A
S.f s = f r
@andreasabel andreasabel self-assigned this Apr 21, 2016
@andreasabel andreasabel added type: enhancement Issues and pull requests about possible improvements projections Issues relating to the treatment of projections overloading Overloaded projections; Projection disambiguation labels Apr 21, 2016
@andreasabel andreasabel added this to the 2.5.1.1 milestone Apr 21, 2016
andreasabel added a commit that referenced this issue Apr 23, 2016
andreasabel added a commit that referenced this issue Apr 23, 2016
pattern indices).

As we have no indexed records, there are no arguments before the
principal argument in projection patterns.
andreasabel added a commit that referenced this issue Apr 23, 2016
Generalize inverseScopeLookup machinery for overloaded constructors.
andreasabel added a commit that referenced this issue Apr 23, 2016
We can ignore opened record values when disambiguating an overloaded
projection pattern.
andreasabel added a commit that referenced this issue Apr 23, 2016
Quick and dirty implementation: just try all projection candidates.
andreasabel added a commit that referenced this issue Apr 23, 2016
Then, the elimination of wrong projection candidates is very cheap.
@andreasabel
Copy link
Member Author

Does not work yet with copied projections:

module _ where

module M (A : Set) where
  record R : Set where
    field f : A

module N A = M A

open M using (R)
open M.R using (f)
open N.R using (f)

r :  A (a : A)  R A
f (r A a) = a

test :  A (a : A)  A
test A a = f (r A a)
Cannot resolve overloaded projection f because several matching
candidates found: [Issue1944-module.M.R.f,Issue1944-module.N.R.f]
when checking that the expression f (r A a) has type A

@WolframKahl
Copy link
Member

The original post here provides a test case for this proposed change (and possibly enhancement).

I would feel safer if there was also a future ChangeLog entry... (that is, a specification...) 😉

andreasabel added a commit that referenced this issue Apr 29, 2016
andreasabel added a commit that referenced this issue Apr 29, 2016
Clashing field names is no longer an error (as it was already for constructors).
andreasabel added a commit that referenced this issue Apr 29, 2016
@asr asr modified the milestones: 2.5.1.1, 2.5.2 May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
overloading Overloaded projections; Projection disambiguation projections Issues relating to the treatment of projections type: enhancement Issues and pull requests about possible improvements
Projects
None yet
Development

No branches or pull requests

3 participants