Skip to content

Zinc invalidation when nested inline method changes #11861

Closed
@adpi2

Description

@adpi2

Compiler version

Latest nightly:

scalaVersion :=  "3.0.0-RC2-bin-20210320-0195dff-NIGHTLY"

Minimized code

// Show.scala
case class Show(name: String)
  
object Show:
  inline given Show = foo
  
  private inline def foo: Show = Show("foo")
// App.scala
@main def app() =
  println(summon[Show].name)

Output

  1. compile and run
sbt:dotty-bug> run
[info] compiling 2 Scala sources to /home/piquerez/lampepfl/dotty-bug/target/scala-3.0.0-RC2/classes ...
[info] running app 
foo
[success] Total time: 0 s, completed Mar 23, 2021, 2:55:05 PM
  1. change the implimation of the private inline foo method
 object Show:
   inline given Show = foo
   
-  private inline def foo: Show = Show("foo")
+  private inline def foo: Show = Show("bar")
  1. compile and run again
sbt:dotty-bug> run
[info] compiling 1 Scala source to /home/piquerez/lampepfl/dotty-bug/target/scala-3.0.0-RC2/classes ...
[info] running app 
foo
[success] Total time: 0 s, completed Mar 23, 2021, 2:57:21 PM

The app.scala file is not invalidated and thus not recompiled.
The produced program should print "bar" instead of "foo".

Expectation

The app.scala file should be recompiled.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions