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

substitute this in dependent method type #5958

Closed
scabug opened this issue Jun 21, 2012 · 5 comments
Closed

substitute this in dependent method type #5958

scabug opened this issue Jun 21, 2012 · 5 comments

Comments

@scabug
Copy link

scabug commented Jun 21, 2012

this code should compile, but doesn't:
(from http://stackoverflow.com/questions/11110409/scala-path-dependent-return-type-from-parameter)

class Test {
  def newComponent(u: Universe): u.Component = ???

  class Universe { self =>
    class Component

    newComponent(this): this.Component // error, but should be fine since this is a stable reference
    newComponent(self): self.Component // error, but should be fine since this is a stable reference
    newComponent(self): this.Component // error, but should be fine since this is a stable reference
    newComponent(this): self.Component // error, but should be fine since this is a stable reference

    val u = this
    newComponent(u): u.Component // ok
  }
}
@scabug
Copy link
Author

scabug commented Jun 21, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5958?orig=1
Reporter: @adriaanm
Other Milestones: 2.10.0-M5, 2.10.0

@scabug
Copy link
Author

scabug commented Jun 21, 2012

Rich Oliver (rich oliver) said (edited on Jun 21, 2012 11:19:12 PM UTC):
When the bug is fixed could we have a clarification of what functionality self types support in terms of path dependant types. The self in the above examples is a simple this alias. But say we have:

class Outer {
val myInner: Inner
class Inner
}

class OtherA { selfA: Outer => }
class OtherB { selfB: Outer.myInner => }
class OtherC { selfC: Outer#Inner }

What should compile and if it will, can the compiler track the path dependant self references?

@scabug
Copy link
Author

scabug commented Jun 22, 2012

@adriaanm said:
please take clarification questions to scala-language, where everybody benefits (and you benefit from a bigger pool of potential answerererers)

@scabug
Copy link
Author

scabug commented Jul 25, 2012

@adriaanm said:
scala/scala#991

@scabug scabug closed this as completed Aug 4, 2012
@scabug
Copy link
Author

scabug commented Dec 10, 2012

@adriaanm said (edited on Dec 13, 2012 11:03:36 PM UTC):
scala/scala#1764

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