Skip to content

Unable to return terms with path dependent types #9464

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

Closed
nicolasstucki opened this issue Jul 29, 2020 · 0 comments
Closed

Unable to return terms with path dependent types #9464

nicolasstucki opened this issue Jul 29, 2020 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

Minimized code

trait T:
  type X
  def x: X

def test1(t: T): t.X = t.x
def test2(t: T): t.X = return t.x

Output

-- [E007] Type Mismatch Error: tests/pos-macros/return-quoted.scala:6:32 -------
6 |def test2(t: T): t.X = return t.x
  |                              ^^^
  |                              Found:    t.X
  |                              Required: t.X
1 error found

Expectation

Should compile

nicolasstucki pushed a commit to dotty-staging/dotty that referenced this issue Aug 13, 2020
We need to substitute type as well as term parameters in the expected
type of a return to handle dependent methods correctly.
nicolasstucki added a commit that referenced this issue Aug 13, 2020
Fix #9464: Fix computation of expected type in a return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants