Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,9 @@ object Types {
case et: ExprType => true
case _ => false
}
if (tp.cls.is(Trait) || zeroParams(tp.cls.primaryConstructor.info)) tp // !!! needs to be adapted once traits have parameters
// `ImplicitFunctionN` does not have constructors
val ctor = tp.cls.primaryConstructor
if (!ctor.exists || zeroParams(ctor.info)) tp
else NoType
case tp: AppliedType =>
zeroParamClass(tp.superType)
Expand Down
7 changes: 7 additions & 0 deletions tests/neg/i7980.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
trait Evidence[X]

trait Trait[X : Evidence]
def method(x : X) : X

given ev : Evidence[Int] = new Evidence[Int]{}
val crash : Trait[Int] = (x: Int) => x // error