@@ -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
@@ -242,8 +242,10 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
242
242
243
243
inlining.println(i " ----------------------- \n Inlining $call\n With RHS $rhsToInline" )
244
244
245
- // Make sure all type arguments to the call are fully determined
246
- for (targ <- callTypeArgs) fullyDefinedType(targ.tpe, " inlined type argument" , targ.span)
245
+ // Make sure all type arguments to the call are fully determined,
246
+ // but continue if that's not achievable (or else i7459.scala would crash).
247
+ for arg <- callTypeArgs do
248
+ isFullyDefined(arg.tpe, ForceDegree .all)
247
249
248
250
/** A map from parameter names of the inlineable method to references of the actual arguments.
249
251
* For a type argument this is the full argument type.
@@ -316,9 +318,9 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
316
318
317
319
/** Populate `paramBinding` and `bindingsBuf` by matching parameters with
318
320
* corresponding arguments. `bindingbuf` will be further extended later by
319
- * proxies to this-references.
321
+ * proxies to this-references. Issue an error if some arguments are missing.
320
322
*/
321
- private def computeParamBindings (tp : Type , targs : List [Tree ], argss : List [List [Tree ]]): Unit = tp match {
323
+ private def computeParamBindings (tp : Type , targs : List [Tree ], argss : List [List [Tree ]]): Boolean = tp match
322
324
case tp : PolyType =>
323
325
tp.paramNames.lazyZip(targs).foreach { (name, arg) =>
324
326
paramSpan(name) = arg.span
@@ -327,8 +329,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
327
329
computeParamBindings(tp.resultType, Nil , argss)
328
330
case tp : MethodType =>
329
331
if argss.isEmpty then
330
- // can happen if arguments have errors, see i7438.scala
331
332
ctx.error(i " mising arguments for inline method $inlinedMethod" , call.sourcePos)
333
+ false
332
334
else
333
335
tp.paramNames.lazyZip(tp.paramInfos).lazyZip(argss.head).foreach { (name, paramtp, arg) =>
334
336
paramSpan(name) = arg.span
@@ -341,7 +343,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
341
343
case _ =>
342
344
assert(targs.isEmpty)
343
345
assert(argss.isEmpty)
344
- }
346
+ true
345
347
346
348
// Compute val-definitions for all this-proxies and append them to `bindingsBuf`
347
349
private def computeThisBindings () = {
@@ -450,7 +452,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
450
452
}
451
453
452
454
// Compute bindings for all parameters, appending them to bindingsBuf
453
- computeParamBindings(inlinedMethod.info, callTypeArgs, callValueArgss)
455
+ if ! computeParamBindings(inlinedMethod.info, callTypeArgs, callValueArgss) then
456
+ return call
454
457
455
458
// make sure prefix is executed if it is impure
456
459
if (! isIdempotentExpr(inlineCallPrefix)) registerType(inlinedMethod.owner.thisType)
0 commit comments