We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents df809fb + 9e98d6d commit 193f7deCopy full SHA for 193f7de
compiler/src/dotty/tools/dotc/core/Types.scala
@@ -4518,7 +4518,9 @@ object Types {
4518
case et: ExprType => true
4519
case _ => false
4520
}
4521
- if (tp.cls.is(Trait) || zeroParams(tp.cls.primaryConstructor.info)) tp // !!! needs to be adapted once traits have parameters
+ // `ImplicitFunctionN` does not have constructors
4522
+ val ctor = tp.cls.primaryConstructor
4523
+ if (!ctor.exists || zeroParams(ctor.info)) tp
4524
else NoType
4525
case tp: AppliedType =>
4526
zeroParamClass(tp.superType)
tests/neg/i7980.scala
@@ -0,0 +1,7 @@
1
+trait Evidence[X]
2
+
3
+trait Trait[X : Evidence]
4
+ def method(x : X) : X
5
6
+given ev : Evidence[Int] = new Evidence[Int]{}
7
+val crash : Trait[Int] = (x: Int) => x // error
0 commit comments