@@ -216,17 +216,21 @@ class PrettyType private (
216
216
toMods(info),
217
217
Name (" " ),
218
218
paramss.iterator
219
- .map(params => params.symbols.smap(toTermParam))
219
+ .map(params => Term . ParamClause ( params.symbols.smap(toTermParam) ))
220
220
.toList
221
221
)
222
222
} else {
223
223
Decl .Def (
224
224
toMods(info),
225
225
Term .Name (info.displayName),
226
- tparams.smap(toTypeParam),
227
- paramss.iterator
228
- .map(params => params.symbols.smap(toTermParam))
229
- .toList,
226
+ List (
227
+ Member .ParamClauseGroup (
228
+ tparams.smap(toTypeParam),
229
+ paramss.iterator
230
+ .map(params => Term .ParamClause (params.symbols.smap(toTermParam)))
231
+ .toList,
232
+ )
233
+ ),
230
234
toType(ret)
231
235
)
232
236
}
@@ -267,7 +271,7 @@ class PrettyType private (
267
271
Defn .Trait (
268
272
toMods(info),
269
273
Type .Name (info.displayName),
270
- tparams.smap(toTypeParam),
274
+ Type . ParamClause ( tparams.smap(toTypeParam) ),
271
275
Ctor .Primary (Nil , Name (" " ), Seq .empty[Term .ParamClause ]),
272
276
Template (
273
277
Nil ,
@@ -279,7 +283,8 @@ class PrettyType private (
279
283
! i.isVarSetter
280
284
) toStat(i)
281
285
else Nil
282
- }
286
+ },
287
+ Nil
283
288
)
284
289
)
285
290
case k.OBJECT =>
@@ -290,7 +295,8 @@ class PrettyType private (
290
295
Nil ,
291
296
inits,
292
297
Self (Name (" " ), None ),
293
- objectDecls
298
+ objectDecls,
299
+ Nil
294
300
)
295
301
)
296
302
case k.PACKAGE_OBJECT =>
@@ -301,35 +307,36 @@ class PrettyType private (
301
307
Nil ,
302
308
inits,
303
309
Self (Name (" " ), None ),
304
- objectDecls
310
+ objectDecls,
311
+ Nil
305
312
)
306
313
)
307
314
case k.CLASS =>
308
315
val ctor : Ctor .Primary = declarations
309
316
.collectFirst {
310
317
case i if i.kind.isConstructor && i.is(p.PRIMARY ) =>
311
318
toTree(i) match {
312
- case ctor @ Ctor .Primary (_, _, Nil :: Nil )
319
+ case ctor @ Ctor .Primary . After_4_6_0 (_, _, Nil :: Nil )
313
320
if ! info.is(p.CASE ) =>
314
321
// Remove redudant () for non-case classes: class Foo
315
322
ctor.copy(paramss = Nil )
316
323
case e : Ctor .Primary => e
317
324
}
318
325
}
319
326
.getOrElse {
320
- Ctor .Primary (Nil , Name (" " ), Seq .empty[Term .ParamClause ])
327
+ Ctor .Primary . After_4_6_0 (Nil , Name (" " ), Seq .empty[Term .ParamClause ])
321
328
}
322
329
323
330
// FIXME: Workaround for https://github.com/scalameta/scalameta/issues/1492
324
- val isCtorName = ctor.paramss .flatMap(_.map(_.name.value) ).toSet
331
+ val isCtorName = ctor.paramClauses .flatMap(_.values). map(_.name.value).toSet
325
332
def isSyntheticMember (m : s.SymbolInformation ): Boolean =
326
333
(isCaseClass && isCaseClassMethod(m.displayName)) ||
327
334
isCtorName(m.displayName)
328
335
329
336
Defn .Class (
330
337
toMods(info),
331
338
Type .Name (info.displayName),
332
- tparams.smap(toTypeParam),
339
+ Type . ParamClause ( tparams.smap(toTypeParam) ),
333
340
ctor,
334
341
Template (
335
342
Nil ,
@@ -342,7 +349,8 @@ class PrettyType private (
342
349
! isSyntheticMember(i)
343
350
) toStat(i)
344
351
else Nil
345
- }
352
+ },
353
+ Nil
346
354
)
347
355
)
348
356
case _ =>
@@ -353,14 +361,14 @@ class PrettyType private (
353
361
Defn .Type (
354
362
toMods(info),
355
363
Type .Name (info.displayName),
356
- typeParameters.smap(toTypeParam),
364
+ Type . ParamClause ( typeParameters.smap(toTypeParam) ),
357
365
toType(lo)
358
366
)
359
367
} else {
360
368
Decl .Type (
361
369
toMods(info),
362
370
Type .Name (info.displayName),
363
- typeParameters.smap(toTypeParam),
371
+ Type . ParamClause ( typeParameters.smap(toTypeParam) ),
364
372
toTypeBounds(lo, hi)
365
373
)
366
374
}
@@ -389,7 +397,7 @@ class PrettyType private (
389
397
case _ =>
390
398
tpe
391
399
}
392
- Init (
400
+ Init . After_4_6_0 (
393
401
toType(fixed),
394
402
Name .Anonymous (),
395
403
// Can't support term arguments
@@ -518,14 +526,14 @@ class PrettyType private (
518
526
def targs : List [Type ] =
519
527
typeArguments.iterator.map {
520
528
case TypeExtractors .Wildcard () =>
521
- Type .Placeholder (Type .Bounds (None , None ))
529
+ Type .Wildcard (Type .Bounds (None , None ))
522
530
case targ =>
523
531
toType(targ)
524
532
}.toList
525
533
symbol match {
526
534
case TypeExtractors .FunctionN () if typeArguments.lengthCompare(0 ) > 0 =>
527
535
val params :+ res = targs
528
- Type .Function (params, res)
536
+ Type .Function (Type . FuncParamClause ( params) , res)
529
537
case TypeExtractors .TupleN () if typeArguments.lengthCompare(1 ) > 0 =>
530
538
Type .Tuple (targs)
531
539
case _ =>
@@ -548,7 +556,7 @@ class PrettyType private (
548
556
case (name : Type .Name , Seq (lhs, rhs))
549
557
if ! Character .isJavaIdentifierPart(name.value.head) =>
550
558
Type .ApplyInfix (lhs, name, rhs)
551
- case (q, targs) => Type .Apply (q, targs)
559
+ case (q, targs) => Type .Apply (q, Type . ArgClause ( targs) )
552
560
}
553
561
}
554
562
case s.SingleType (_, symbol) =>
@@ -634,7 +642,7 @@ class PrettyType private (
634
642
Defn .Type (
635
643
Nil ,
636
644
universalName,
637
- typeParameters.smap(toTypeParam),
645
+ Type . ParamClause ( typeParameters.smap(toTypeParam) ),
638
646
toType(underlying)
639
647
) :: Nil
640
648
),
@@ -681,7 +689,7 @@ class PrettyType private (
681
689
Type .Param (
682
690
Nil ,
683
691
Name (" " ),
684
- Nil ,
692
+ Type . ParamClause ( Nil ) ,
685
693
Type .Bounds (None , None ),
686
694
Nil ,
687
695
Nil
@@ -698,7 +706,7 @@ class PrettyType private (
698
706
Type .Param (
699
707
toMods(info),
700
708
name = Type .Name (info.displayName),
701
- tparams = tparams,
709
+ tparamClause = Type . ParamClause ( tparams) ,
702
710
tbounds = bounds,
703
711
// TODO: re-sugar context and view bounds https://github.com/scalacenter/scalafix/issues/759
704
712
vbounds = Nil ,
0 commit comments