@@ -2016,6 +2016,11 @@ class Namer { typer: Typer =>
20162016      paramFn : Type  =>  Type ,
20172017      fallbackProto : Type 
20182018    )(using  Context ):  Type  = 
2019+     /**  Is this member tracked? This is true if it is marked as `tracked` or if 
2020+      *  it overrides a `tracked` member. To account for the later, `isTracked` 
2021+      *  is overriden to `true` as a side-effect of computing `inherited`. 
2022+      */  
2023+     var  isTracked :  Boolean  =  sym.is(Tracked )
20192024
20202025    /**  A type for this definition that might be inherited from elsewhere: 
20212026     *  If this is a setter parameter, the corresponding getter type. 
@@ -2053,15 +2058,12 @@ class Namer { typer: Typer =>
20532058
20542059          val  iDenot  =  cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema, sym.targetName)
20552060          val  iSym  =  iDenot.symbol
2061+           if  iSym.is(Tracked ) then  isTracked =  true 
20562062          val  iRawInfo  =  iDenot.info
20572063          val  iResType  =  instantiatedResType(iRawInfo, paramss).asSeenFrom(site, cls)
2058-           if  iSym.is(Tracked ) &&  ! mdef.rhs.isEmpty then 
2059-             //  When inherting a tracked member, we infer a precise type from the rhs
2060-             tp &  typedAheadExpr(mdef.rhs, iResType).tpe
2061-           else 
2062-             if  (iResType.exists)
2063-               typr.println(i " using inherited type for  ${mdef.name}; raw:  $iRawInfo, inherited:  $iResType" )
2064-             tp &  iResType
2064+           if  (iResType.exists)
2065+             typr.println(i " using inherited type for  ${mdef.name}; raw:  $iRawInfo, inherited:  $iResType" )
2066+           tp &  iResType
20652067        }
20662068    end  inherited 
20672069
@@ -2146,6 +2148,7 @@ class Namer { typer: Typer =>
21462148            if  defaultTp.exists then  TypeOps .SimplifyKeepUnchecked () else  null )
21472149        match 
21482150          case  ctp : ConstantType  if  sym.isInlineVal =>  ctp
2151+           case  tp if  isTracked =>  tp
21492152          case  tp =>  TypeComparer .widenInferred(tp, pt, Widen .Unions )
21502153
21512154    //  Replace aliases to Unit by Unit itself. If we leave the alias in
@@ -2156,7 +2159,7 @@ class Namer { typer: Typer =>
21562159    def  lhsType  =  fullyDefinedType(cookedRhsType, " right-hand side"  , mdef.srcPos)
21572160    // if (sym.name.toString == "y") println(i"rhs = $rhsType, cooked = $cookedRhsType")
21582161    if  (inherited.exists)
2159-       if  sym.isInlineVal then  lhsType else  inherited
2162+       if  sym.isInlineVal ||  isTracked  then  lhsType else  inherited
21602163    else  {
21612164      if  (sym.is(Implicit ))
21622165        mdef match  {
0 commit comments