Skip to content

Commit 724088c

Browse files
committed
wip 3
1 parent 41f8542 commit 724088c

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
@@ -1055,6 +1055,8 @@ class TreeUnpickler(reader: TastyReader,
10551055
}
10561056

10571057
def makeSelect(qual: Tree, name: Name, denot: Denotation): Select =
1058+
// if ctx.source.name.startsWith("hashsetremove") then
1059+
// report.echo(i"select $denot from $qual.$name")
10581060
var qualType = qual.tpe.widenIfUnstable
10591061
val owner = denot.symbol.maybeOwner
10601062
if (owner.isPackageObject && qualType.termSymbol.is(Package))
@@ -1076,7 +1078,14 @@ class TreeUnpickler(reader: TastyReader,
10761078

10771079
def accessibleDenot(qualType: Type, name: Name, sig: Signature, target: Name) = {
10781080
val pre = ctx.typeAssigner.maybeSkolemizePrefix(qualType, name)
1079-
val d = qualType.findMember(name, pre).atSignature(sig, target)
1081+
// if ctx.source.name.startsWith("hashsetremove") then
1082+
// report.echo(i"accessibleDenot $name @ $sig from $pre")
1083+
val d0 = qualType.findMember(name, pre)
1084+
// if ctx.source.name.startsWith("hashsetremove") then
1085+
// report.echo(i"d0 = $d0")
1086+
val d = d0.atSignature(sig, target)
1087+
// if ctx.source.name.startsWith("hashsetremove") then
1088+
// report.echo(i"d = $d")
10801089
if (!d.symbol.exists || d.symbol.isAccessibleFrom(pre)) d
10811090
else qualType.findMember(name, pre, excluded = Private).atSignature(sig, target)
10821091
}
@@ -1182,16 +1191,8 @@ class TreeUnpickler(reader: TastyReader,
11821191
// Test Report
11831192
// ================================================================================
11841193

1185-
// tests/run/eff-dependent.scala failed
1186-
// tests/pos/conversion-function-prototype.scala failed
1187-
// tests/pos/i8516.scala failed
1188-
// tests/pos/avoid.scala failed
1189-
// tests/pos/i7872.scala failed
1190-
// tests/pos/i5980.scala failed
1191-
// tests/pos/i5418.scala failed
1192-
// tests/pos/depfuntype.scala failed
1193-
// tests/pos/i5720.scala failed
1194-
// tests/pos/i7807.scala failed
1194+
1195+
// tests/run/hashsetremove.scala
11951196
var sname = readName()
11961197
val qual = readTerm()
11971198
val qualType = qual.tpe.widenIfUnstable
@@ -1203,9 +1204,11 @@ class TreeUnpickler(reader: TastyReader,
12031204
sname match
12041205
case SignedName(name, sig, target) =>
12051206
val pre = ctx.typeAssigner.maybeSkolemizePrefix(qualType, name)
1206-
val isAmbiguous = pre.nonPrivateMember(name).isOverloaded
1207-
if ctx.source.name.startsWith("i9050") then
1208-
report.echo(i"select $name at $sig isAmbig? $isAmbiguous")
1207+
val isAmbiguous =
1208+
val denot = pre.nonPrivateMember(name)
1209+
denot.isOverloaded || !denot.atSignature(sig, target).exists
1210+
// if ctx.source.name.startsWith("hashsetremove") then
1211+
// report.echo(i"select $name at $sig isAmbig? $isAmbiguous - ${pre.nonPrivateMember(name)}")
12091212
if isAmbiguous then
12101213
selectAmbiguous(name, pre, space.decl(name).atSignature(sig, target))
12111214
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)