Skip to content

Commit 80f99c2

Browse files
committed
wip 2
1 parent db6f2a6 commit 80f99c2

File tree

5 files changed

+46
-43
lines changed

5 files changed

+46
-43
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,6 @@ class TreePickler(pickler: TastyPickler) {
425425
pickleTree(qual)
426426
if tree.symbol.exists then
427427
pickleType(tree.symbol.owner.typeRef)
428-
// else
429-
// pickleType(defn.NothingType)
430428
}
431429
}
432430
case Apply(fun, args) =>

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,6 @@ class TreeUnpickler(reader: TastyReader,
10651065
case name: TypeName => TypeRef(qualType, name, denot)
10661066
case name: TermName => TermRef(qualType, name, denot)
10671067
}
1068-
if ctx.source.name.startsWith("i") && name.isTermName then
1069-
report.echo(i"""complete select $qual.$name as $tpe""")
10701068
ConstFold.Select(untpd.Select(qual, name).withType(tpe))
10711069

10721070
def completeSelect(name: Name, sig: Signature, target: Name): Select =
@@ -1199,21 +1197,23 @@ class TreeUnpickler(reader: TastyReader,
11991197
var sname = readName()
12001198
val qual = readTerm()
12011199
val qualType = qual.tpe.widenIfUnstable
1202-
val space = if currentAddr == end then ??? else readType()
1203-
def select(name: Name, denot: Denotation) =
1204-
val prefix = ctx.typeAssigner.maybeSkolemizePrefix(qualType, name)
1205-
makeSelect(qual, name, denot.asSeenFrom(prefix))
1200+
val space = if currentAddr == end then qualType else readType()
1201+
def selectAmbiguous(name: Name, pre: Type, denot: Denotation) =
1202+
makeSelect(qual, name, denot.asSeenFrom(pre))
1203+
def select(name: Name, sig: Signature, target: Name) =
1204+
makeSelect(qual, name, accessibleDenot(qualType, name, sig, target))
12061205
sname match
12071206
case SignedName(name, sig, target) =>
1208-
// val isAmbiguous = qualType.nonPrivateMember(name) match
1209-
// case d: MultiDenotation => d.atSignature(sig, target).isInstanceOf[MultiDenotation]
1210-
// case _ => false
1211-
// if isAmbiguous then
1212-
// select(name, space.decl(name).atSignature(sig, target))
1213-
// else
1214-
completeSelect(name, sig, target)
1207+
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")
1211+
if isAmbiguous then
1212+
selectAmbiguous(name, pre, space.decl(name).atSignature(sig, target))
1213+
else
1214+
select(name, sig, target)
12151215
case name =>
1216-
completeSelect(name, Signature.NotAMethod, EmptyTermName)
1216+
select(name, Signature.NotAMethod, EmptyTermName)
12171217
case REPEATED =>
12181218
val elemtpt = readTpt()
12191219
SeqLiteral(until(end)(readTerm()), elemtpt)

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
171171

172172
protected def handleRuntimeException(ex: RuntimeException)(using Context): Nothing = ex match {
173173
case ex: BadSignature => throw ex
174-
case _ => errorBadSignature(s"a runtime exception occurred: $ex", Some(ex))
174+
case _ => errorBadSignature(s"a runtime exception occurred: $ex at ${ex.getStackTrace.mkString("\n")}", Some(ex))
175175
}
176176

177177
def run()(using Context): Unit =

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,39 @@ class FromTastyTests {
1313
import TestConfiguration._
1414
import FromTastyTests._
1515

16-
@Test def posTmpTestFromTasty: Unit = {
17-
// Can be reproduced with
18-
// > sbt
19-
// > scalac -Ythrough-tasty -Ycheck:all <source>
20-
21-
implicit val testGroup: TestGroup = TestGroup("posTmpTestFromTasty")
22-
compileTastyInDir(s"tests${JFile.separator}pos-tmp", defaultOptions,
23-
fromTastyFilter = FileFilter.exclude(TestSources.posFromTastyBlacklisted)
24-
).checkCompile()
25-
}
26-
27-
// @Test def posTestFromTasty: Unit = {
16+
// @Test def posTmpTestFromTasty: Unit = {
2817
// // Can be reproduced with
2918
// // > sbt
3019
// // > scalac -Ythrough-tasty -Ycheck:all <source>
3120

32-
// implicit val testGroup: TestGroup = TestGroup("posTestFromTasty")
33-
// compileTastyInDir(s"tests${JFile.separator}pos", defaultOptions,
21+
// implicit val testGroup: TestGroup = TestGroup("posTmpTestFromTasty")
22+
// compileTastyInDir(s"tests${JFile.separator}pos-tmp", defaultOptions,
3423
// fromTastyFilter = FileFilter.exclude(TestSources.posFromTastyBlacklisted)
3524
// ).checkCompile()
3625
// }
3726

38-
// @Test def runTestFromTasty: Unit = {
39-
// // Can be reproduced with
40-
// // > sbt
41-
// // > scalac -Ythrough-tasty -Ycheck:all <source>
42-
// // > scala Test
27+
@Test def posTestFromTasty: Unit = {
28+
// Can be reproduced with
29+
// > sbt
30+
// > scalac -Ythrough-tasty -Ycheck:all <source>
4331

44-
// implicit val testGroup: TestGroup = TestGroup("runTestFromTasty")
45-
// compileTastyInDir(s"tests${JFile.separator}run", defaultOptions,
46-
// fromTastyFilter = FileFilter.exclude(TestSources.runFromTastyBlacklisted)
47-
// ).checkRuns()
48-
// }
32+
implicit val testGroup: TestGroup = TestGroup("posTestFromTasty")
33+
compileTastyInDir(s"tests${JFile.separator}pos", defaultOptions,
34+
fromTastyFilter = FileFilter.exclude(TestSources.posFromTastyBlacklisted)
35+
).checkCompile()
36+
}
37+
38+
@Test def runTestFromTasty: Unit = {
39+
// Can be reproduced with
40+
// > sbt
41+
// > scalac -Ythrough-tasty -Ycheck:all <source>
42+
// > scala Test
43+
44+
implicit val testGroup: TestGroup = TestGroup("runTestFromTasty")
45+
compileTastyInDir(s"tests${JFile.separator}run", defaultOptions,
46+
fromTastyFilter = FileFilter.exclude(TestSources.runFromTastyBlacklisted)
47+
).checkRuns()
48+
}
4949
}
5050

5151
object FromTastyTests extends ParallelTesting {

tests/pos-tmp/i8516.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
val x: Function1[Int, Int] { def apply(arg: Int): Int } = x => x
1+
abstract class Fn1[-A, +B] {
2+
def apply(v1: A, x: Int): B
3+
}
4+
val x: Fn1[Int, Int] { def apply(arg: Int, i: Int): Int } = new Fn1[Int, Int] {
5+
def apply(arg: Int, i: Int): Int = arg
6+
}
27
val x1 = x
3-
val y = x.apply(arg = 1)
8+
val y = x.apply(arg = 1, i = 2)

0 commit comments

Comments
 (0)