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

infer signatures like dotty #147

Closed
adriaanm opened this issue May 23, 2016 · 1 comment
Closed

infer signatures like dotty #147

adriaanm opened this issue May 23, 2016 · 1 comment
Milestone

Comments

@adriaanm
Copy link
Contributor

  • prefer result type of overridden method over type of RHS of the overriding method in a subclass
  • require result type for implicit definition
@adriaanm adriaanm added this to the Backlog milestone May 24, 2016
@som-snytt
Copy link

Completed more or less.

With and without -Xsource:3

scala> class C { def f: Option[Int] = Some(42) }
class C

scala> class D extends C { override def f = None }
class D

scala> class E extends D { override def f = Some(27) }
class E

scala>
:quit
➜  ~ scala
Welcome to Scala 2.13.10 (OpenJDK 64-Bit Server VM, Java 19).
Type in expressions for evaluation. Or try :help.

scala> class C { def f: Option[Int] = Some(42) }
class C

scala> class D extends C { override def f = None }
class D

scala> class E extends D { override def f = Some(27) }
                                                ^
       error: type mismatch;
        found   : Some[Int]
        required: None.type

Explicit types for implicits in 2.13.11 scala/scala#10083

I'd be OK if either the types were renamed or maybe just inscribed in a honorary plaque at the top of the stairs at EPFL:

class Som[A](a: A) extends Option[A]
or

type Sombyl = Symbol  // a little too close to Sybil of the 16 personalities, not Disraeli's two nations
                      // https://en.wikipedia.org/wiki/Sybil_(Schreiber_book)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants