-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix undercompilation upon ctor change (#19911)
Fixes #19910 Fixes sbt/zinc#1334 ## Problem Scala 3 compiler registers special `zincMangledName` for constructors for the purpose of incremental compilation. Currently the `zincMangledName` contains the package name, which does not match the use site tracking, thereby causing undercompilation during incremental compilation after a ctor change, like adding a parameter. There is an existing scripted test, but coincidentally the test class does NOT include packages, so the test ends up passing. ## Solution 1. This PR reproduces the issue by adding package name to the test. 2. This also fixes the problem by changing the `zincMangedName` to `sym.owner.name ++ ";init;"`. ## Note about zincMangedName `zincMangedName` in general is a good idea, which adds the class name into otherwise common name `<init>`. By making the name more unique it prevents overcompilation when one of the ctors changes in a file.
- Loading branch information
Showing
6 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
package example | ||
|
||
class A(a: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
package example | ||
|
||
class B { val y = new A(2) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
package example | ||
|
||
class A(a: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
package example | ||
|
||
class B { val y = new A("a") } |