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

Handle structural types with curried methods #5391

Merged
merged 1 commit into from Nov 8, 2018

Conversation

Projects
None yet
2 participants
@allanrenucci
Copy link
Member

allanrenucci commented Nov 5, 2018

We desugar x.foo(a1)(a2) (where the type of x is a structural type) to:

(x:selectable).applyDynamic("a", CTa1, CTa2)(a1, a2)

@allanrenucci allanrenucci force-pushed the dotty-staging:struct-types branch from 3214645 to 7713a98 Nov 5, 2018

@allanrenucci allanrenucci requested review from Duhemm and odersky Nov 5, 2018

@allanrenucci allanrenucci force-pushed the dotty-staging:struct-types branch 3 times, most recently from 6b743b4 to 7b712ff Nov 5, 2018

@odersky
Copy link
Contributor

odersky left a comment

I believe we do not want this. It prevents the use case where a selectDynamic returns a function value that is then applied.

Show resolved Hide resolved compiler/src/dotty/tools/dotc/ast/TreeInfo.scala Outdated

@allanrenucci allanrenucci force-pushed the dotty-staging:struct-types branch from 7b712ff to 4ce85a9 Nov 8, 2018

Handle structural types with curried methods
- We desugar `x.foo(a1)(a2)` (where the type of `x` is a structural type)
  to:

  ```scala
  (x:selectable).applyDynamic("a", CTa1, CTa2)(a1, a2)
  ```

- Add test cases for implicit and dependant methods

- Rejects all dependant methods used in structural type. They are pretty
  broken currently. Should be fixable

@allanrenucci allanrenucci force-pushed the dotty-staging:struct-types branch from 4ce85a9 to 59c90d1 Nov 8, 2018

@allanrenucci

This comment has been minimized.

Copy link
Member

allanrenucci commented Nov 8, 2018

I believe we do not want this. It prevents the use case where a selectDynamic returns a function value that is then applied.

No, I made sure this use case still works. I have added test cases:

assert(x.sel1(2) == 2)

val f = x.sel1
assert(f(3) == 3)

@odersky

This comment has been minimized.

Copy link
Contributor

odersky commented Nov 8, 2018

OK, convinced now that the use case still works.

@odersky

odersky approved these changes Nov 8, 2018

Copy link
Contributor

odersky left a comment

I believe we do not want this. It prevents the use case where a selectDynamic returns a function value that is then applied.

@allanrenucci allanrenucci merged commit 2d407aa into lampepfl:master Nov 8, 2018

2 checks passed

CLA User signed CLA
Details
continuous-integration/drone/pr the build was successful
Details

@allanrenucci allanrenucci deleted the dotty-staging:struct-types branch Nov 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment