File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
chimney-macro-commons/src/main/scala-3/io/scalaland/chimney/internal/compiletime Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -320,11 +320,13 @@ private[compiletime] trait TypesPlatform extends Types { this: DefinitionsPlatfo
320
320
321
321
// Classes defined inside a "class" or "def" have package.name.ClassName removed from the type,
322
322
// so we have to prepend it ourselves to keep behavior consistent with Scala 2.
323
- if symbolFullName != colorlessReprName && symbolFullName.endsWith(" __" + colorlessReprName)
324
- then symbolFullName.substring(0 , symbolFullName.length - 2 - colorlessReprName.length) + colorfulReprName
325
- else if symbolFullName != colorlessReprName && symbolFullName.endsWith(" _" + colorlessReprName)
326
- then symbolFullName.substring(0 , symbolFullName.length - 1 - colorlessReprName.length) + colorfulReprName
327
- else colorfulReprName
323
+ if symbolFullName != colorlessReprName then {
324
+ val pkg_Len = symbolFullName.length - colorlessReprName.length
325
+ (0 to pkg_Len).takeWhile(i => symbolFullName.endsWith((" _" * i) + colorlessReprName)).lastOption match {
326
+ case Some (_Len) => symbolFullName.substring(0 , pkg_Len - _Len) + colorfulReprName
327
+ case None => colorfulReprName
328
+ }
329
+ } else colorfulReprName
328
330
}
329
331
.getOrElse(repr.toString)
330
332
}
You can’t perform that action at this time.
0 commit comments