File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -1100,6 +1100,10 @@ trait Typers extends Modes with Adaptations with Tags {
1100
1100
instantiateToMethodType(mt)
1101
1101
1102
1102
case _ =>
1103
+ def shouldInsertApply (tree : Tree ) = inAllModes(mode, EXPRmode | FUNmode ) && (tree.tpe match {
1104
+ case _ : MethodType | _ : OverloadedType | _ : PolyType => false
1105
+ case _ => applyPossible
1106
+ })
1103
1107
def applyPossible = {
1104
1108
def applyMeth = member(adaptToName(tree, nme.apply), nme.apply)
1105
1109
dyna.acceptsApplyDynamic(tree.tpe) || (
@@ -1117,10 +1121,7 @@ trait Typers extends Modes with Adaptations with Tags {
1117
1121
macroExpand(this , tree, mode, pt)
1118
1122
else if ((mode & (PATTERNmode | FUNmode )) == (PATTERNmode | FUNmode ))
1119
1123
adaptConstrPattern()
1120
- else if (inAllModes(mode, EXPRmode | FUNmode ) &&
1121
- ! tree.tpe.isInstanceOf [MethodType ] &&
1122
- ! tree.tpe.isInstanceOf [OverloadedType ] &&
1123
- applyPossible)
1124
+ else if (shouldInsertApply(tree))
1124
1125
insertApply()
1125
1126
else if (! context.undetparams.isEmpty && ! inPolyMode(mode)) { // (9)
1126
1127
assert(! inHKMode(mode), modeString(mode)) // @M
Original file line number Diff line number Diff line change
1
+ import language .dynamics
2
+
3
+ object Test {
4
+ def main (args : Array [String ]) {
5
+ class Lenser [T ] extends Dynamic {
6
+ def selectDynamic (propName : String ) = ???
7
+ }
8
+
9
+ def lens [T ] = new Lenser [T ]
10
+
11
+ val qq = lens[String ]
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments