Skip to content

Commit edfb6e7

Browse files
committed
Merge pull request #886 from dotty-staging/fix-#884
Fix #884 - misdiagnosed ambiguous definition.
2 parents 201ce2f + 4f9b5cc commit edfb6e7

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
200200
*/
201201
def isDefinedInCurrentUnit(denot: Denotation): Boolean = denot match {
202202
case MultiDenotation(d1, d2) => isDefinedInCurrentUnit(d1) || isDefinedInCurrentUnit(d2)
203-
case denot: SingleDenotation => denot.symbol.sourceFile == ctx.source
203+
case denot: SingleDenotation => denot.symbol.sourceFile == ctx.source.file
204204
}
205205

206206
/** Is `denot` the denotation of a self symbol? */

test/dotc/tests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class tests extends CompilerTest {
7777
@Test def pos_desugar() = compileFile(posDir, "desugar", twice)
7878
@Test def pos_sigs() = compileFile(posDir, "sigs", twice)
7979
@Test def pos_typers() = compileFile(posDir, "typers", twice)
80-
@Test def pos_typedidents() = compileFile(posDir, "typedIdents", twice)
80+
@Test def pos_typedIdents() = compileDir(posDir, "typedIdents", twice)
8181
@Test def pos_assignments() = compileFile(posDir, "assignments", twice)
8282
@Test def pos_packageobject() = compileFile(posDir, "packageobject", twice)
8383
@Test def pos_overloaded() = compileFile(posDir, "overloaded", twice)
@@ -103,7 +103,7 @@ class tests extends CompilerTest {
103103
@Test def neg_abstractOverride() = compileFile(negDir, "abstract-override", xerrors = 2)
104104
@Test def neg_blockescapes() = compileFile(negDir, "blockescapesNeg", xerrors = 1)
105105
@Test def neg_typedapply() = compileFile(negDir, "typedapply", xerrors = 4)
106-
@Test def neg_typedidents() = compileFile(negDir, "typedIdents", xerrors = 2)
106+
@Test def neg_typedIdents() = compileDir(negDir, "typedIdents", xerrors = 2)
107107
@Test def neg_assignments() = compileFile(negDir, "assignments", xerrors = 3)
108108
@Test def neg_typers() = compileFile(negDir, "typers", xerrors = 14)(allowDoubleBindings)
109109
@Test def neg_privates() = compileFile(negDir, "privates", xerrors = 2)

tests/neg/typedIdents/PQ.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package P {
2+
object X { val x = 1; val y = 2 }
3+
}
4+
package Q {
5+
object X { val x = true; val y = "" }
6+
}

tests/neg/typedIdents.scala renamed to tests/neg/typedIdents/typedIdents.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
package P {
2-
object X { val x = 1; val y = 2 }
3-
}
4-
package Q {
5-
object X { val x = true; val y = "" }
6-
}
71
package P { // `X' bound by package clause
82
import Console._ // `println' bound by wildcard import
93
object A {

tests/pos/i884.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import scala.reflect._
2+
3+
object `package` {
4+
}

tests/pos/overloadedAccess.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ object overloadedAccess {
1414
val x = f("abc")
1515
val y: Int = x
1616
}
17-
1817
}

tests/pos/typedIdents/PQ.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package P {
2+
object X { val x = 1; val y = 2 }
3+
}
4+
package Q {
5+
object X { val x = true; val y = "" }
6+
}

tests/pos/typedIdents.scala renamed to tests/pos/typedIdents/typedIdents.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
package P {
2-
object X { val x = 1; val y = 2 }
3-
}
4-
package Q {
5-
object X { val x = true; val y = "" }
6-
}
71
package P { // `X' bound by package clause
82
import Console._ // `println' bound by wildcard import
93
object A {

0 commit comments

Comments
 (0)