File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
compiler/src/dotty/tools/dotc/sbt
sbt-dotty/sbt-test/source-dependencies/value-class-underlying Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import StdNames._
17
17
import NameKinds .DefaultGetterName
18
18
import typer .Inliner
19
19
import typer .ErrorReporting .cyclicErrorMsg
20
+ import transform .ValueClasses
20
21
import transform .SymUtils ._
21
22
import dotty .tools .io .Path
22
23
import java .io .PrintWriter
@@ -254,8 +255,17 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
254
255
val cinfo = csym.classInfo
255
256
256
257
val bases =
257
- try linearizedAncestorTypes(cinfo)
258
- catch {
258
+ try {
259
+ val ancestorTypes0 = linearizedAncestorTypes(cinfo)
260
+ if (ValueClasses .isDerivedValueClass(csym)) {
261
+ val underlying = ValueClasses .valueClassUnbox(csym).info.finalResultType
262
+ // The underlying type of a value class should be part of the name hash
263
+ // of the value class (see the test `value-class-underlying`), this is accomplished
264
+ // by adding the underlying type to the list of parent types.
265
+ underlying :: ancestorTypes0
266
+ } else
267
+ ancestorTypes0
268
+ } catch {
259
269
case ex : CyclicReference =>
260
270
// See neg/i1750a for an example where a cyclic error can arise.
261
271
// The root cause in this example is an illegal "override" of an inner trait
Original file line number Diff line number Diff line change 1
1
object C {
2
2
def main (args : Array [String ]): Unit = {
3
- val x = B .foo
4
- println(" x : " + x ) // Need to use x in an expression to see if it crashes or not
3
+ val duck = B .foo
4
+ println(" duck : " + duck ) // Need to use duck in an expression to see if it crashes or not
5
5
}
6
6
}
You can’t perform that action at this time.
0 commit comments