File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -1323,15 +1323,8 @@ class Namer { typer: Typer =>
1323
1323
def cookedRhsType = deskolemize(dealiasIfUnit(widenRhs(rhsType)))
1324
1324
def lhsType = fullyDefinedType(cookedRhsType, " right-hand side" , mdef.span)
1325
1325
// if (sym.name.toString == "y") println(i"rhs = $rhsType, cooked = $cookedRhsType")
1326
- if (inherited.exists) {
1327
- if (sym.is(Final , butNot = Method )) {
1328
- val tp = lhsType
1329
- if (tp.isInstanceOf [ConstantType ])
1330
- tp // keep constant types that fill in for a non-constant (to be revised when inline has landed).
1331
- else inherited
1332
- }
1333
- else inherited
1334
- }
1326
+ if (inherited.exists)
1327
+ if (isInlineVal) lhsType else inherited
1335
1328
else {
1336
1329
if (sym.is(Implicit ))
1337
1330
mdef match {
Original file line number Diff line number Diff line change
1
+ trait TC [T ] { def x : Int ; def y : Int = 0 }
2
+
3
+ given [T ] as TC [T ] {
4
+ inline val x = 1
5
+ }
6
+
7
+ given as TC [Int ] {
8
+ inline val x = 2
9
+ inline override val y = 3
10
+ }
11
+
12
+ object Test extends App {
13
+ val z : 2 = the[TC [Int ]].x
14
+ val _: 3 = the[TC [Int ]].y
15
+ }
You can’t perform that action at this time.
0 commit comments