Commit 3af67ba 1 parent 8aa59f8 commit 3af67ba Copy full SHA for 3af67ba
File tree 3 files changed +11
-9
lines changed
compiler/src/dotty/tools/dotc/core
3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -191,8 +191,8 @@ class TypeUtils:
191
191
case self : RefinedOrRecType => self.parent.stripRefinement
192
192
case seld => self
193
193
194
- /** The constructors of this tyoe that that are applicable to `argTypes`, without needing
195
- * an implicit conversion.
194
+ /** The constructors of this type that are applicable to `argTypes`, without needing
195
+ * an implicit conversion. Curried constructors are always excluded.
196
196
* @param adaptVarargs if true, allow a constructor with just a varargs argument to
197
197
* match an empty argument list.
198
198
*/
@@ -208,7 +208,7 @@ class TypeUtils:
208
208
&& atPhaseNoLater(Phases .elimRepeatedPhase)(constr.info.isVarArgsMethod)
209
209
then // accept missing argument for varargs parameter
210
210
paramInfos = paramInfos.init
211
- argTypes.corresponds(paramInfos)(_ <:< _)
211
+ argTypes.corresponds(paramInfos)(_ <:< _) && ! ctpe.resultType. isInstanceOf [ MethodType ]
212
212
case _ =>
213
213
false
214
214
recur(constr.info)
Original file line number Diff line number Diff line change 1
- // crash.scala
2
- import scala .language .implicitConversions
3
-
4
1
class MyFunction (args : String )
5
2
6
3
trait MyFunction0 [+ R ] extends MyFunction {
7
4
def apply (): R
8
5
}
9
6
10
7
def fromFunction0 [R ](f : Function0 [R ]): MyFunction0 [R ] = () => f() // error
8
+
9
+ class MyFunctionWithImplicit (implicit args : String )
10
+
11
+ trait MyFunction0WithImplicit [+ R ] extends MyFunctionWithImplicit {
12
+ def apply (): R
13
+ }
14
+
15
+ def fromFunction1 [R ](f : Function0 [R ]): MyFunction0WithImplicit [R ] = () => f() // error
Original file line number Diff line number Diff line change 1
- // crash.scala
2
- import scala .language .implicitConversions
3
-
4
1
class MyFunction (args : String * )
5
2
6
3
trait MyFunction0 [+ R ] extends MyFunction {
You can’t perform that action at this time.
0 commit comments