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] -----------------------------------------------------------------------------
Activity
jchyb commentedon Feb 17, 2025
Bisect script points to 26ecda5 as the first "regressive" commit, which I think makes sense - those two files, if compiled together in the same compilation run, would always error (as it would notice these things while in typer), and in two separate runs, it would try to make the same check in pickler. It could be argued that the behavior now is more consistent.
Gedochao commentedon Feb 18, 2025
@dwijnand thoughts?
The bisect also points to the same commit as #22596 and #22585, btw.
jchyb commentedon Feb 18, 2025
#22596 and #22585 do not have that "always error in one compilation run, but only now error in when split into two" quirk (so they seem more like actual regressions), however #22581 does (but I need to run the bisect script to confirm that it is indeed the same commit)
3 remaining items