@@ -65,18 +65,21 @@ class UnrollDefinitions extends MacroTransform, IdentityDenotTransformer {
65
65
66
66
def computeIndices (annotated : Symbol )(using Context ): ComputedIndicies =
67
67
unrolledDefs.getOrElseUpdate(annotated, {
68
- val indices = annotated
69
- .paramSymss
70
- .zipWithIndex
71
- .flatMap: (paramClause, paramClauseIndex) =>
72
- val annotationIndices = findUnrollAnnotations(paramClause)
73
- if (annotationIndices.isEmpty) None
74
- else Some ((paramClauseIndex, annotationIndices))
75
- if indices.nonEmpty then
76
- // pre-validation should have occurred in posttyper
77
- assert(annotated.is(Final , butNot = Deferred ) || annotated.isConstructor || annotated.owner.is(ModuleClass ),
78
- i " $annotated is not final&concrete, or a constructor " )
79
- indices
68
+ if annotated.name.is(DefaultGetterName ) then
69
+ Nil // happens in curried methods where more than one parameter list has @unroll
70
+ else
71
+ val indices = annotated
72
+ .paramSymss
73
+ .zipWithIndex
74
+ .flatMap: (paramClause, paramClauseIndex) =>
75
+ val annotationIndices = findUnrollAnnotations(paramClause)
76
+ if (annotationIndices.isEmpty) None
77
+ else Some ((paramClauseIndex, annotationIndices))
78
+ if indices.nonEmpty then
79
+ // pre-validation should have occurred in posttyper
80
+ assert(annotated.is(Final , butNot = Deferred ) || annotated.isConstructor || annotated.owner.is(ModuleClass ) || annotated.name.is(DefaultGetterName ),
81
+ i " $annotated is not final&concrete, or a constructor " )
82
+ indices
80
83
})
81
84
end computeIndices
82
85
@@ -103,7 +106,7 @@ class UnrollDefinitions extends MacroTransform, IdentityDenotTransformer {
103
106
params
104
107
.zipWithIndex
105
108
.collect {
106
- case (v, i) if v.annotations.exists(_.symbol.fullName.toString == " scala.annotation.unroll " ) =>
109
+ case (v, i) if v.hasAnnotation(defn. UnrollAnnot ) =>
107
110
i
108
111
}
109
112
}
@@ -303,7 +306,9 @@ class UnrollDefinitions extends MacroTransform, IdentityDenotTransformer {
303
306
case _ => unreachable(" sliding with at least 2 elements" )
304
307
Some ((defdef.symbol, None , generatedDefs))
305
308
306
- case multiple => sys.error(" Cannot have multiple parameter lists containing `@unroll` annotation" )
309
+ case multiple =>
310
+ report.error(" Cannot have multiple parameter lists containing `@unroll` annotation" , defdef.srcPos)
311
+ None
307
312
}
308
313
309
314
case _ => None
0 commit comments