Skip to content

Commit 62d1896

Browse files
committed
wip 3
1 parent 80f99c2 commit 62d1896

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,8 @@ class TreeUnpickler(reader: TastyReader,
10571057
}
10581058

10591059
def makeSelect(qual: Tree, name: Name, denot: Denotation): Select =
1060+
// if ctx.source.name.startsWith("hashsetremove") then
1061+
// report.echo(i"select $denot from $qual.$name")
10601062
var qualType = qual.tpe.widenIfUnstable
10611063
val owner = denot.symbol.maybeOwner
10621064
if (owner.isPackageObject && qualType.termSymbol.is(Package))
@@ -1078,7 +1080,14 @@ class TreeUnpickler(reader: TastyReader,
10781080

10791081
def accessibleDenot(qualType: Type, name: Name, sig: Signature, target: Name) = {
10801082
val pre = ctx.typeAssigner.maybeSkolemizePrefix(qualType, name)
1081-
val d = qualType.findMember(name, pre).atSignature(sig, target)
1083+
// if ctx.source.name.startsWith("hashsetremove") then
1084+
// report.echo(i"accessibleDenot $name @ $sig from $pre")
1085+
val d0 = qualType.findMember(name, pre)
1086+
// if ctx.source.name.startsWith("hashsetremove") then
1087+
// report.echo(i"d0 = $d0")
1088+
val d = d0.atSignature(sig, target)
1089+
// if ctx.source.name.startsWith("hashsetremove") then
1090+
// report.echo(i"d = $d")
10821091
if (!d.symbol.exists || d.symbol.isAccessibleFrom(pre)) d
10831092
else qualType.findMember(name, pre, excluded = Private).atSignature(sig, target)
10841093
}
@@ -1184,16 +1193,8 @@ class TreeUnpickler(reader: TastyReader,
11841193
// Test Report
11851194
// ================================================================================
11861195

1187-
// tests/run/eff-dependent.scala failed
1188-
// tests/pos/conversion-function-prototype.scala failed
1189-
// tests/pos/i8516.scala failed
1190-
// tests/pos/avoid.scala failed
1191-
// tests/pos/i7872.scala failed
1192-
// tests/pos/i5980.scala failed
1193-
// tests/pos/i5418.scala failed
1194-
// tests/pos/depfuntype.scala failed
1195-
// tests/pos/i5720.scala failed
1196-
// tests/pos/i7807.scala failed
1196+
1197+
// tests/run/hashsetremove.scala
11971198
var sname = readName()
11981199
val qual = readTerm()
11991200
val qualType = qual.tpe.widenIfUnstable
@@ -1205,9 +1206,11 @@ class TreeUnpickler(reader: TastyReader,
12051206
sname match
12061207
case SignedName(name, sig, target) =>
12071208
val pre = ctx.typeAssigner.maybeSkolemizePrefix(qualType, name)
1208-
val isAmbiguous = pre.nonPrivateMember(name).isOverloaded
1209-
if ctx.source.name.startsWith("i9050") then
1210-
report.echo(i"select $name at $sig isAmbig? $isAmbiguous")
1209+
val isAmbiguous =
1210+
val denot = pre.nonPrivateMember(name)
1211+
denot.isOverloaded || !denot.atSignature(sig, target).exists
1212+
// if ctx.source.name.startsWith("hashsetremove") then
1213+
// report.echo(i"select $name at $sig isAmbig? $isAmbiguous - ${pre.nonPrivateMember(name)}")
12111214
if isAmbiguous then
12121215
selectAmbiguous(name, pre, space.decl(name).atSignature(sig, target))
12131216
else

tests/pos-tmp/hashsetremove.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import scala.collection.mutable.HashSet
2+
3+
4+
object Test extends App {
5+
val h = new HashSet[Int]
6+
h += 1
7+
assert(!h.remove(0))
8+
assert(h(1))
9+
assert(h.remove(1))
10+
assert(!h(1))
11+
assert(!h.remove(1))
12+
assert(!h(1))
13+
}

tests/pos-tmp/i8516.scala

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)