@@ -216,17 +216,25 @@ class PrettyType private (
216
216
toMods(info),
217
217
Name (" " ),
218
218
paramss.iterator
219
- .map(params => params.symbols.smap(toTermParam))
219
+ .map(params =>
220
+ Term .ParamClause (params.symbols.smap(toTermParam))
221
+ )
220
222
.toList
221
223
)
222
224
} else {
223
225
Decl .Def (
224
226
toMods(info),
225
227
Term .Name (info.displayName),
226
- tparams.smap(toTypeParam),
227
- paramss.iterator
228
- .map(params => params.symbols.smap(toTermParam))
229
- .toList,
228
+ List (
229
+ Member .ParamClauseGroup (
230
+ tparams.smap(toTypeParam),
231
+ paramss.iterator
232
+ .map(params =>
233
+ Term .ParamClause (params.symbols.smap(toTermParam))
234
+ )
235
+ .toList
236
+ )
237
+ ),
230
238
toType(ret)
231
239
)
232
240
}
@@ -267,7 +275,7 @@ class PrettyType private (
267
275
Defn .Trait (
268
276
toMods(info),
269
277
Type .Name (info.displayName),
270
- tparams.smap(toTypeParam),
278
+ Type . ParamClause ( tparams.smap(toTypeParam) ),
271
279
Ctor .Primary (Nil , Name (" " ), Seq .empty[Term .ParamClause ]),
272
280
Template (
273
281
Nil ,
@@ -279,7 +287,8 @@ class PrettyType private (
279
287
! i.isVarSetter
280
288
) toStat(i)
281
289
else Nil
282
- }
290
+ },
291
+ Nil
283
292
)
284
293
)
285
294
case k.OBJECT =>
@@ -290,7 +299,8 @@ class PrettyType private (
290
299
Nil ,
291
300
inits,
292
301
Self (Name (" " ), None ),
293
- objectDecls
302
+ objectDecls,
303
+ Nil
294
304
)
295
305
)
296
306
case k.PACKAGE_OBJECT =>
@@ -301,35 +311,44 @@ class PrettyType private (
301
311
Nil ,
302
312
inits,
303
313
Self (Name (" " ), None ),
304
- objectDecls
314
+ objectDecls,
315
+ Nil
305
316
)
306
317
)
307
318
case k.CLASS =>
308
319
val ctor : Ctor .Primary = declarations
309
320
.collectFirst {
310
321
case i if i.kind.isConstructor && i.is(p.PRIMARY ) =>
311
322
toTree(i) match {
312
- case ctor @ Ctor .Primary (_, _, Nil :: Nil )
313
- if ! info.is(p.CASE ) =>
323
+ case ctor @ Ctor .Primary .After_4_6_0 (
324
+ _,
325
+ _,
326
+ Term .ParamClause (Nil , _)
327
+ ) if ! info.is(p.CASE ) =>
314
328
// Remove redudant () for non-case classes: class Foo
315
329
ctor.copy(paramss = Nil )
316
330
case e : Ctor .Primary => e
317
331
}
318
332
}
319
333
.getOrElse {
320
- Ctor .Primary (Nil , Name (" " ), Seq .empty[Term .ParamClause ])
334
+ Ctor .Primary .After_4_6_0 (
335
+ Nil ,
336
+ Name (" " ),
337
+ Seq .empty[Term .ParamClause ]
338
+ )
321
339
}
322
340
323
341
// FIXME: Workaround for https://github.com/scalameta/scalameta/issues/1492
324
- val isCtorName = ctor.paramss.flatMap(_.map(_.name.value)).toSet
342
+ val isCtorName =
343
+ ctor.paramClauses.flatMap(_.values).map(_.name.value).toSet
325
344
def isSyntheticMember (m : s.SymbolInformation ): Boolean =
326
345
(isCaseClass && isCaseClassMethod(m.displayName)) ||
327
346
isCtorName(m.displayName)
328
347
329
348
Defn .Class (
330
349
toMods(info),
331
350
Type .Name (info.displayName),
332
- tparams.smap(toTypeParam),
351
+ Type . ParamClause ( tparams.smap(toTypeParam) ),
333
352
ctor,
334
353
Template (
335
354
Nil ,
@@ -342,7 +361,8 @@ class PrettyType private (
342
361
! isSyntheticMember(i)
343
362
) toStat(i)
344
363
else Nil
345
- }
364
+ },
365
+ Nil
346
366
)
347
367
)
348
368
case _ =>
@@ -353,14 +373,14 @@ class PrettyType private (
353
373
Defn .Type (
354
374
toMods(info),
355
375
Type .Name (info.displayName),
356
- typeParameters.smap(toTypeParam),
376
+ Type . ParamClause ( typeParameters.smap(toTypeParam) ),
357
377
toType(lo)
358
378
)
359
379
} else {
360
380
Decl .Type (
361
381
toMods(info),
362
382
Type .Name (info.displayName),
363
- typeParameters.smap(toTypeParam),
383
+ Type . ParamClause ( typeParameters.smap(toTypeParam) ),
364
384
toTypeBounds(lo, hi)
365
385
)
366
386
}
@@ -389,7 +409,7 @@ class PrettyType private (
389
409
case _ =>
390
410
tpe
391
411
}
392
- Init (
412
+ Init . After_4_6_0 (
393
413
toType(fixed),
394
414
Name .Anonymous (),
395
415
// Can't support term arguments
@@ -518,14 +538,14 @@ class PrettyType private (
518
538
def targs : List [Type ] =
519
539
typeArguments.iterator.map {
520
540
case TypeExtractors .Wildcard () =>
521
- Type .Placeholder (Type .Bounds (None , None ))
541
+ Type .Wildcard (Type .Bounds (None , None ))
522
542
case targ =>
523
543
toType(targ)
524
544
}.toList
525
545
symbol match {
526
546
case TypeExtractors .FunctionN () if typeArguments.lengthCompare(0 ) > 0 =>
527
547
val params :+ res = targs
528
- Type .Function (params, res)
548
+ Type .Function (Type . FuncParamClause ( params) , res)
529
549
case TypeExtractors .TupleN () if typeArguments.lengthCompare(1 ) > 0 =>
530
550
Type .Tuple (targs)
531
551
case _ =>
@@ -548,7 +568,7 @@ class PrettyType private (
548
568
case (name : Type .Name , Seq (lhs, rhs))
549
569
if ! Character .isJavaIdentifierPart(name.value.head) =>
550
570
Type .ApplyInfix (lhs, name, rhs)
551
- case (q, targs) => Type .Apply (q, targs)
571
+ case (q, targs) => Type .Apply (q, Type . ArgClause ( targs) )
552
572
}
553
573
}
554
574
case s.SingleType (_, symbol) =>
@@ -634,7 +654,7 @@ class PrettyType private (
634
654
Defn .Type (
635
655
Nil ,
636
656
universalName,
637
- typeParameters.smap(toTypeParam),
657
+ Type . ParamClause ( typeParameters.smap(toTypeParam) ),
638
658
toType(underlying)
639
659
) :: Nil
640
660
),
@@ -681,7 +701,7 @@ class PrettyType private (
681
701
Type .Param (
682
702
Nil ,
683
703
Name (" " ),
684
- Nil ,
704
+ Type . ParamClause ( Nil ) ,
685
705
Type .Bounds (None , None ),
686
706
Nil ,
687
707
Nil
@@ -698,7 +718,7 @@ class PrettyType private (
698
718
Type .Param (
699
719
toMods(info),
700
720
name = Type .Name (info.displayName),
701
- tparams = tparams,
721
+ tparamClause = Type . ParamClause ( tparams) ,
702
722
tbounds = bounds,
703
723
// TODO: re-sugar context and view bounds https://github.com/scalacenter/scalafix/issues/759
704
724
vbounds = Nil ,
0 commit comments