Open
Description
https://github.com/VirtusLab/community-build3/actions/runs/13209505213/job/36881078477
Compiler version
Working: 3.6.3
Broken: 3.6.4-RC1
Minimized code
Similarly to #22581, the files have to be compiled in separate compilation runs for the regression to show. Let's use scala-cli for simplicity.
main.scala
import scala.quoted.*
package jam {
trait JamCoreDsl {
implicit inline def defaultJamConfig: this.JamConfig =
new JamConfig(brewRecRegex = ".*")
class JamConfig(val brewRecRegex: String)
inline def brew(implicit inline config: JamConfig): Unit = ${ brewImpl() }
}
private object internal extends JamCoreDsl
export internal._
def brewImpl(using q: Quotes)(): Expr[Unit] = {
findSelf
'{()}
}
private def findSelf(using q: Quotes): Unit = {
import q.reflect.*
def rec(s: Symbol): Option[Symbol] = s.maybeOwner match {
case o if o.isNoSymbol => None
case o if o.isClassDef => Option(o)
case o => rec(o)
}
rec(Symbol.spliceOwner)
}
}
main.test.scala
object CoreSpec {
jam.brew
}
scala-cli test main.scala main.test.scala -S 3.6.4-RC1
Output
[error] -- [E007] Type Mismatch Error: /Users/jchyb/workspace/community-build3/repo/core/src-3/jam/package.scala:2:12
[error] 2 | jam.brew
[error] | ^
[error] | Found: jam.internal.JamConfig
[error] | Required: ?1.JamConfig
[error] |
[error] | where: ?1 is an unknown value of type object jam.internal
[error] |-----------------------------------------------------------------------------
[error] | Explanation (enabled by `-explain`)
[error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error] |
[error] | Tree: {
[error] | val JamCoreDsl_this: jam.internal.type = jam.internal
[error] | new JamCoreDsl_this.JamConfig(brewRecRegex = ".*"):JamCoreDsl_this.JamConfig
[error] | }
[error] | I tried to show that
[error] | jam.internal.JamConfig
[error] | conforms to
[error] | ?1.JamConfig
[error] | but none of the attempts shown below succeeded:
[error] |
[error] | ==> jam.internal.JamConfig <: ?1.JamConfig
[error] | ==> jam.internal.type <: (?1 : object jam.internal)
[error] | ==> object jam.internal <: (?1 : object jam.internal) = false
[error] |
[error] | The tests were made under the empty constraint
[error] -----------------------------------------------------------------------------
Expectation
No error. Although, similarly to #22581, if both files are put into the same compilation run, another error is shown (also on earlier compiler versions):
[error] -- [E007] Type Mismatch Error: /Users/jchyb/workspace/community-build3/repo/core/src-3/jam/package.scala:2:12
[error] 2 | jam.brew
[error] | ^
[error] | Found: jam.internal.JamConfig
[error] | Required: Nothing
[error] |-----------------------------------------------------------------------------
[error] | Explanation (enabled by `-explain`)
[error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error] |
[error] | Tree: {
[error] | val JamCoreDsl_this: jam.internal.type = jam.internal
[error] | new JamCoreDsl_this.JamConfig(brewRecRegex = ".*"):JamCoreDsl_this.JamConfig
[error] | }
[error] | I tried to show that
[error] | jam.internal.JamConfig
[error] | conforms to
[error] | Nothing
[error] | but none of the attempts shown below succeeded:
[error] |
[error] | ==> jam.internal.JamConfig <: Nothing = false
[error] |
[error] | The tests were made under the empty constraint
[error] -----------------------------------------------------------------------------