-
Notifications
You must be signed in to change notification settings - Fork 21
Spurious type error in super constructor call under -Xexperimental (since sammy merge) #9141
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9141?orig=1 |
@adriaanm said: scala> samOf(typeOf[java.io.InputStream])
res1: $r.intp.global.Symbol = method read and -Ytyper-debug on the example says: | | |-- { super.<init>(url.openStream); () } EXPRmode (site: <init> in B)
| | | |-- super.<init>(url.openStream) BYVALmode-EXPRmode (site: <init> in B)
| | | | |-- super EXPRmode-POLYmode-QUALmode (silent: <init> in B)
| | | | | |-- this EXPRmode (silent: <init> in B)
| | | | | | \-> B
| | | | | \-> B.super.type (with underlying type A)
| | | | |-- url.openStream : pt=java.io.InputStream BYVALmode-EXPRmode (site: <init> in <empty>)
| | | | | |-- url EXPRmode-POLYmode-QUALmode (site: <init> in <empty>)
| | | | | | \-> url.type (with underlying type java.net.URL)
| | | | | |-- { (() => url.openStream()) } : pt=java.io.InputStream BYVALmode-EXPRmode (site: <init> in <empty>)
| | | | | | |-- (() => url.openStream()) : pt=java.io.InputStream BYVALmode-EXPRmode (site: <init> in <empty>)
| | | | | | | |-- { def read$body(): Int = url.openStream(); final class $a... : pt=java.io.InputStream BYVALmode-EXPRmode (site: <init> in <empty>)
| | | | | | | | |-- def read$body BYVALmode-EXPRmode (site: <init> in <empty>)
| | | | | | | | | |-- url.openStream() : pt=Int EXPRmode (site: method read$body in <empty>)
| | | | | | | | | | |-- url.openStream BYVALmode-EXPRmode-FUNmode-POLYmode (silent: method read$body in <empty>)
| | | | | | | | | | | \-> ()java.io.InputStream
/Users/adriaan/Desktop/bugs/t9141.scala:2: error: type mismatch;
found : java.io.InputStream
required: Int
class B(url: java.net.URL) extends A(url.openStream)
^ |
@adriaanm said: The reason this doesn't type-check under -Xexperimental is because it meets the criteria for eta-expansion as defined at http://scala-lang.org/files/archive/spec/2.11/06-expressions.html#eta-expansion (where "function type" is generalized to include sam types). Without -Xexperimental, it went straight to "empty application". |
The code in this example can be compiled. Also, the -Xexperimental option has been deprecated since Scala 2.13.0, so the issue itself can be closed. |
Distilled from
ProcessBuilderImpl.scala
in the stdlib.Regressed in scala/scala@9c36a7617
The text was updated successfully, but these errors were encountered: