@@ -185,7 +185,15 @@ object Inlines:
185
185
// transforms the patterns into terms, the `inlinePatterns` phase removes this anonymous class by β-reducing
186
186
// the call to the `unapply`.
187
187
188
- val UnApply (fun, implicits, patterns) = unapp
188
+ object SplitFunAndGivenArgs :
189
+ def unapply (tree : Tree ): (Tree , List [List [Tree ]]) = tree match
190
+ case Apply (SplitFunAndGivenArgs (fn, argss), args) => (fn, argss :+ args)
191
+ case _ => (tree, Nil )
192
+ val UnApply (SplitFunAndGivenArgs (fun, leadingImplicits), trailingImplicits, patterns) = unapp
193
+ if leadingImplicits.flatten.nonEmpty then
194
+ // To support them see https://github.com/lampepfl/dotty/pull/13158
195
+ report.error(" inline unapply methods with given parameters before the scrutinee are not supported" , fun)
196
+
189
197
val sym = unapp.symbol
190
198
val cls = newNormalizedClassSymbol(ctx.owner, tpnme.ANON_CLASS , Synthetic | Final , List (defn.ObjectType ), coord = sym.coord)
191
199
val constr = newConstructor(cls, Synthetic , Nil , Nil , coord = sym.coord).entered
@@ -204,7 +212,7 @@ object Inlines:
204
212
val cdef = ClassDef (cls, DefDef (constr), List (unapply))
205
213
val newUnapply = Block (cdef :: Nil , New (cls.typeRef, Nil ))
206
214
val newFun = newUnapply.select(unappplySym).withSpan(unapp.span)
207
- cpy.UnApply (unapp)(newFun, implicits , patterns)
215
+ cpy.UnApply (unapp)(newFun, trailingImplicits , patterns)
208
216
end inlinedUnapply
209
217
210
218
/** For a retained inline method, another method that keeps track of
0 commit comments