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
views inference on non-accessible selection #6074
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6074?orig=1 |
@lrytz said: object T {
def m = new ConfigBuilder()
implicit def build( cb: ConfigBuilder ) : Config = null
}
class Config(x: Int)
class ConfigBuilder private () { } Second one, crash in Symbols.info object Config {
def apply() : ConfigBuilder = new ConfigBuilder()
implicit def build( cb: ConfigBuilder ) : Config = cb.build
}
final class Config private[Client]( val clientID: Int )
final class ConfigBuilder {
var clientID: Int = 0
def build : Config = new Config( clientID )
} |
@lrytz said: |
@lrytz said: |
@lrytz said: spec clarification in scala/scala-dist#50 |
@retronym said: |
Spec:
However, the implementation also searches for an implicit conversion when m denotes a
non-accessible member of T:
Even worse, the same happens for constructors! An expression "new T()" is represented
as a tree Apply(Selelct(New(T), ), ())
If the constructor is private, an conversion to "?{def : ?}" is searched! This generates
invalid trees and crashes later phases, e.g. NamesDefaults, #5231, but also GenICode,
as in the following example:
The text was updated successfully, but these errors were encountered: