Skip to content

Commit fb753dc

Browse files
committed
Add test and drop diagnostic output unless debugging
1 parent 6310d9e commit fb753dc

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,16 +610,13 @@ object Denotations {
610610
*/
611611
def signature(sourceLanguage: SourceLanguage)(using Context): Signature =
612612
if (isType) Signature.NotAMethod // don't force info if this is a type denotation
613-
else info match {
613+
else info match
614614
case info: MethodOrPoly =>
615615
try info.signature(sourceLanguage)
616-
catch { // !!! DEBUG
617-
case scala.util.control.NonFatal(ex) =>
618-
report.echo(s"cannot take signature of $info")
619-
throw ex
620-
}
616+
catch case ex: Exception =>
617+
if ctx.debug then report.echo(s"cannot take signature of $info")
618+
throw ex
621619
case _ => Signature.NotAMethod
622-
}
623620

624621
def derivedSingleDenotation(symbol: Symbol, info: Type, pre: Type = this.prefix, isRefinedMethod: Boolean = this.isRefinedMethod)(using Context): SingleDenotation =
625622
if ((symbol eq this.symbol) && (info eq this.info) && (pre eq this.prefix) && (isRefinedMethod == this.isRefinedMethod)) this

tests/neg/i16407.check

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- Error: tests/neg/i16407.scala:2:2 -----------------------------------------------------------------------------------
2+
2 | f(g()) // error // error
3+
| ^
4+
| cannot resolve reference to type (X.this : Y & X).A
5+
| the classfile defining the type might be missing from the classpath
6+
| or the self type of (X.this : Y & X) might not contain all transitive dependencies
7+
-- Error: tests/neg/i16407.scala:2:4 -----------------------------------------------------------------------------------
8+
2 | f(g()) // error // error
9+
| ^
10+
| cannot resolve reference to type (X.this : Y & X).A
11+
| the classfile defining the type might be missing from the classpath
12+
| or the self type of (X.this : Y & X) might not contain all transitive dependencies

tests/neg/i16407.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
trait X { self: Y =>
2+
f(g()) // error // error
3+
}
4+
trait Y { self: Z =>
5+
type B = A
6+
def f(a: B): Unit = ()
7+
def g(): A = ???
8+
}
9+
trait Z {
10+
type A
11+
}

0 commit comments

Comments
 (0)