Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Nov 9, 2023
1 parent f1ae9b3 commit c1a6f88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
// skip this member
return NoSymbol

// Adapt the flags of getters so they become like vals/vars instead
if flags.isAllOf(Method | Accessor) && !name.toString().endsWith("_$eq") then
flags &~= Method | Accessor
if !flags.is(StableRealizable) then flags |= Mutable

name = name.adjustIfModuleClass(flags)
if (flags.is(Method))
name =
Expand Down Expand Up @@ -620,7 +625,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
setClassInfo(denot, tp, fromScala2 = true, selfInfo)
NamerOps.addConstructorProxies(denot.classSymbol)
case denot =>
val tp1 = translateTempPoly(tp)
val tp0 = translateTempPoly(tp)
val tp1 =
if !denot.is(Param) && !denot.is(Method) && tp0.isInstanceOf[ExprType] then
tp0.asInstanceOf[ExprType].resultType
else tp0

denot.info =
if (tag == ALIASsym) TypeAlias(tp1)
else if (denot.isType) checkNonCyclic(denot.symbol, tp1, reportErrors = false)
Expand Down
4 changes: 2 additions & 2 deletions tests/neg/constructor-proxy-shadowing.check
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
17 |val x = Seq(3) // error: shadowing
| ^^^
| Reference to constructor proxy for class Seq
| shadows outer reference to getter Seq in package scala
| shadows outer reference to value Seq in package scala
|
| The instance needs to be created with an explicit `new`.
|--------------------------------------------------------------------------------------------------------------------
Expand All @@ -66,7 +66,7 @@
|
| new Seq(...)
|
| Or it could mean calling the apply method of getter Seq in package scala as in
| Or it could mean calling the apply method of value Seq in package scala as in
|
| Seq.apply(...)
|
Expand Down

0 comments on commit c1a6f88

Please sign in to comment.