File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
compiler/src/dotty/tools/dotc/core
tests/neg-custom-args/captures Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1191,12 +1191,13 @@ class Definitions {
1191
1191
}
1192
1192
1193
1193
object DependentFunctionRefinementOf {
1194
- /** Matches a refined `FunctionN[...]` or `ContextFunctionN[...]` type and extracts the function type and apply info.
1194
+ /** Matches a dependent refinement of `FunctionN[...]` or `ContextFunctionN[...]` type.
1195
+ * Extracts the method type type and apply info.
1195
1196
*
1196
1197
* Pattern: `$ft { def apply: $mt }`
1197
1198
*/
1198
1199
def unapply (ft : Type )(using Context ): Option [(Type , MethodType )] = ft.dealias match
1199
- case RefinedType (parent, nme.apply, mt : MethodType ) if isFunctionNType(parent) =>
1200
+ case RefinedType (parent, nme.apply, mt : MethodType ) if isFunctionNType(parent) && mt.isResultDependent =>
1200
1201
Some ((parent, mt))
1201
1202
case _ => None
1202
1203
}
Original file line number Diff line number Diff line change 2
2
10 | h(f2()) // error
3
3
| ^^^^
4
4
| Found: (x$0: Int) ->{cap1} Int
5
- | Required: (x$0: Int) ->{cap2} Int
5
+ | Required: Int ->{cap2} Int
6
6
|
7
7
| longer explanation available when compiling with `-explain`
8
8
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/byname.scala:19:5 ----------------------------------------
You can’t perform that action at this time.
0 commit comments