diff options
author | Seth Tisue <seth@tisue.net> | 2016-08-27 07:21:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-27 07:21:52 -0700 |
commit | 18b75748dfb3e790b4c4be67155e2f1682fc85e2 (patch) | |
tree | 6449e637fb1e7de2ec7716bffcc04fe5c692ca24 | |
parent | 3fe62eac2ae3a701aac74aa63a969cd1e47bab30 (diff) | |
parent | d275b0372b661d4df22db52f0ec3802843332ad6 (diff) | |
download | scala-18b75748dfb3e790b4c4be67155e2f1682fc85e2.tar.gz scala-18b75748dfb3e790b4c4be67155e2f1682fc85e2.tar.bz2 scala-18b75748dfb3e790b4c4be67155e2f1682fc85e2.zip |
Merge pull request #5357 from SethTisue/topic/sd-206
SAM for subtypes of FunctionN
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | test/files/pos/sammy_extends_function.scala | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 33cf5b9a09..a95ecd360c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -773,7 +773,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper else FunctionClass(numVparams) } - if (samSym.exists && samSym.owner != correspondingFunctionSymbol) // don't treat Functions as SAMs + if (samSym.exists && tp.typeSymbol != correspondingFunctionSymbol) // don't treat Functions as SAMs wildcardExtrapolation(normalize(tp memberInfo samSym)) else NoType } diff --git a/test/files/pos/sammy_extends_function.scala b/test/files/pos/sammy_extends_function.scala new file mode 100644 index 0000000000..e8cf5d8749 --- /dev/null +++ b/test/files/pos/sammy_extends_function.scala @@ -0,0 +1,4 @@ +// https://github.com/scala/scala-dev/issues/206 + +trait T extends Function1[String, String] +object O { (x => x): T } |