Skip to content

Commit 18b7574

Browse files
authored
Merge pull request scala#5357 from SethTisue/topic/sd-206
SAM for subtypes of FunctionN
2 parents 3fe62ea + d275b03 commit 18b7574

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
773773
else FunctionClass(numVparams)
774774
}
775775

776-
if (samSym.exists && samSym.owner != correspondingFunctionSymbol) // don't treat Functions as SAMs
776+
if (samSym.exists && tp.typeSymbol != correspondingFunctionSymbol) // don't treat Functions as SAMs
777777
wildcardExtrapolation(normalize(tp memberInfo samSym))
778778
else NoType
779779
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// https://github.com/scala/scala-dev/issues/206
2+
3+
trait T extends Function1[String, String]
4+
object O { (x => x): T }

0 commit comments

Comments
 (0)