summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-08-27 07:21:52 -0700
committerGitHub <noreply@github.com>2016-08-27 07:21:52 -0700
commit18b75748dfb3e790b4c4be67155e2f1682fc85e2 (patch)
tree6449e637fb1e7de2ec7716bffcc04fe5c692ca24
parent3fe62eac2ae3a701aac74aa63a969cd1e47bab30 (diff)
parentd275b0372b661d4df22db52f0ec3802843332ad6 (diff)
downloadscala-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.scala2
-rw-r--r--test/files/pos/sammy_extends_function.scala4
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 }