@@ -18,7 +18,7 @@ import Names.{Name, TermName}
18
18
import NameKinds .{InlineAccessorName , InlineBinderName , InlineScrutineeName }
19
19
import ProtoTypes .selectionProto
20
20
import SymDenotations .SymDenotation
21
- import Inferencing .fullyDefinedType
21
+ import Inferencing .isFullyDefined
22
22
import config .Printers .inlining
23
23
import ErrorReporting .errorTree
24
24
import dotty .tools .dotc .tastyreflect .ReflectionImpl
@@ -239,8 +239,10 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
239
239
240
240
inlining.println(i " ----------------------- \n Inlining $call\n With RHS $rhsToInline" )
241
241
242
- // Make sure all type arguments to the call are fully determined
243
- for (targ <- callTypeArgs) fullyDefinedType(targ.tpe, " inlined type argument" , targ.span)
242
+ // Make sure all type arguments to the call are fully determined,
243
+ // but continue if that's not achievable (or else i7459.scala would crash).
244
+ for arg <- callTypeArgs do
245
+ isFullyDefined(arg.tpe, ForceDegree .all)
244
246
245
247
/** A map from parameter names of the inlineable method to references of the actual arguments.
246
248
* For a type argument this is the full argument type.
@@ -313,9 +315,9 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
313
315
314
316
/** Populate `paramBinding` and `bindingsBuf` by matching parameters with
315
317
* corresponding arguments. `bindingbuf` will be further extended later by
316
- * proxies to this-references.
318
+ * proxies to this-references. Issue an error if some arguments are missing.
317
319
*/
318
- private def computeParamBindings (tp : Type , targs : List [Tree ], argss : List [List [Tree ]]): Unit = tp match {
320
+ private def computeParamBindings (tp : Type , targs : List [Tree ], argss : List [List [Tree ]]): Boolean = tp match
319
321
case tp : PolyType =>
320
322
tp.paramNames.lazyZip(targs).foreach { (name, arg) =>
321
323
paramSpan(name) = arg.span
@@ -324,8 +326,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
324
326
computeParamBindings(tp.resultType, Nil , argss)
325
327
case tp : MethodType =>
326
328
if argss.isEmpty then
327
- // can happen if arguments have errors, see i7438.scala
328
329
ctx.error(i " mising arguments for inline method $inlinedMethod" , call.sourcePos)
330
+ false
329
331
else
330
332
tp.paramNames.lazyZip(tp.paramInfos).lazyZip(argss.head).foreach { (name, paramtp, arg) =>
331
333
paramSpan(name) = arg.span
@@ -338,7 +340,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
338
340
case _ =>
339
341
assert(targs.isEmpty)
340
342
assert(argss.isEmpty)
341
- }
343
+ true
342
344
343
345
// Compute val-definitions for all this-proxies and append them to `bindingsBuf`
344
346
private def computeThisBindings () = {
@@ -447,7 +449,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
447
449
}
448
450
449
451
// Compute bindings for all parameters, appending them to bindingsBuf
450
- computeParamBindings(inlinedMethod.info, callTypeArgs, callValueArgss)
452
+ if ! computeParamBindings(inlinedMethod.info, callTypeArgs, callValueArgss) then
453
+ return call
451
454
452
455
// make sure prefix is executed if it is impure
453
456
if (! isIdempotentExpr(inlineCallPrefix)) registerType(inlinedMethod.owner.thisType)
0 commit comments