Skip to content

Commit 88b328c

Browse files
committed
Merge AssignProto and LhProto
They serve the same purpose; keep the name LhsProto.
1 parent f6056ae commit 88b328c

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,6 @@ object ProtoTypes {
708708
@sharable object AnyTypeConstructorProto extends UncachedGroundType with MatchAlways:
709709
override def toString = "AnyTypeConstructorProto"
710710

711-
@sharable object LhsProto extends UncachedGroundType with MatchAlways:
712-
override def toString = "LhsProto"
713-
714711
extension (pt: Type)
715712
def isExtensionApplyProto: Boolean = pt match
716713
case PolyProto(targs, res) => res.isExtensionApplyProto
@@ -971,7 +968,7 @@ object ProtoTypes {
971968

972969
final def wildApprox(tp: Type)(using Context): Type = wildApprox(tp, null, Set.empty, Set.empty)
973970

974-
@sharable object AssignProto extends UncachedGroundType with MatchAlways
971+
@sharable object LhsProto extends UncachedGroundType with MatchAlways
975972

976973
private[ProtoTypes] class WildApproxMap(val seen: Set[TypeParamRef], val internal: Set[TypeLambda])(using Context) extends TypeMap {
977974
def apply(tp: Type): Type = wildApprox(tp, this, seen, internal)

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
534534
*/
535535
def toNotNullTermRef(tree: Tree, pt: Type)(using Context): Tree = tree.tpe match
536536
case ref: TermRef
537-
if pt != AssignProto && // Ensure it is not the lhs of Assign
537+
if pt != LhsProto && // Ensure it is not the lhs of Assign
538538
ctx.notNullInfos.impliesNotNull(ref) &&
539539
// If a reference is in the context, it is already trackable at the point we add it.
540540
// Hence, we don't use isTracked in the next line, because checking use out of order is enough.
@@ -744,7 +744,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
744744
&& selName.isTermName && !isDynamicExpansion(tree)
745745
then
746746
val tree2 = cpy.Select(tree0)(untpd.TypedSplice(qual), selName)
747-
if pt.isInstanceOf[FunOrPolyProto] || pt == AssignProto then
747+
if pt.isInstanceOf[FunOrPolyProto] || pt == LhsProto then
748748
assignType(tree2, TryDynamicCallType)
749749
else
750750
typedDynamicSelect(tree2, Nil, pt)
@@ -1090,8 +1090,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
10901090
typed(appliedUpdate, pt)
10911091
case lhs =>
10921092
val locked = ctx.typerState.ownedVars
1093-
val lhsCore = typedUnadapted(lhs, AssignProto, locked)
1094-
def lhs1 = adapt(lhsCore, AssignProto, locked)
1093+
val lhsCore = typedUnadapted(lhs, LhsProto, locked)
1094+
def lhs1 = adapt(lhsCore, LhsProto, locked)
10951095

10961096
def reassignmentToVal =
10971097
report.error(ReassignmentToVal(lhsCore.symbol.name), tree.srcPos)
@@ -4028,7 +4028,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
40284028
if (implicitFun || caseCompanion)
40294029
&& !isApplyProto(pt)
40304030
&& pt != SingletonTypeProto
4031-
&& pt != AssignProto
4031+
&& pt != LhsProto
40324032
&& !ctx.mode.is(Mode.Pattern)
40334033
&& !tree.isInstanceOf[SplicePattern]
40344034
&& !ctx.isAfterTyper

0 commit comments

Comments
 (0)