@@ -727,19 +727,40 @@ object Build {
727727 " https://repo1.maven.org/maven2/com/lihaoyi/fansi_3/0.5.1/fansi_3-0.5.1-sources.jar" ,
728728 " https://repo1.maven.org/maven2/com/lihaoyi/sourcecode_3/0.4.3-M5/sourcecode_3-0.4.3-M5-sources.jar" ,
729729 )
730- val sourceManagedPath = os.Path ((Compile / sourceManaged).value)
731- for (download <- downloads) os.unzip.stream(requests.get.stream(download), dest = sourceManagedPath)
732- for (file <- os.walk(sourceManagedPath) if file.ext == " scala" ) yield {
730+ val sourceManagedPath = os.Path ((Compile / sourceManaged).value / " downloaded" )
731+ os.remove.all(sourceManagedPath)
732+ os.makeDir.all(sourceManagedPath)
733+ for (download <- downloads) {
734+ os.unzip.stream(requests.get.stream(download), dest = sourceManagedPath)
735+ }
736+ for {
737+ file <- os.walk(sourceManagedPath)
738+ if file.ext == " scala"
739+ if file.last != " CollectionName.scala"
740+ } yield {
733741 val text = os.read(file)
734- if (! text.contains(" package scala" )){
735- os.write.over(
736- file,
737- " package dotty.shaded\n " +
738- text
739- .replace(" _root_.pprint" , " _root_.dotty.shaded.pprint" )
740- .replace(" _root_.fansi" , " _root_.dotty.shaded.fansi" )
741- )
742- }
742+ os.write.over(
743+ file,
744+ " package dotty.shaded\n " +
745+ text
746+ .replace(" import scala" , " import _root_.scala" )
747+ .replace(" scala.collection." , " _root_.scala.collection." )
748+ .replace(" _root_.pprint" , " _root_.dotty.shaded.pprint" )
749+ .replace(" _root_.fansi" , " _root_.dotty.shaded.fansi" )
750+ .replace(" def apply(c: Char): Trie[T]" , " def apply(c: Char): Trie[T] | Null" )
751+ .replace(" var head: Iterator[T] = null" , " var head: Iterator[T] | Null = null" )
752+ .replace(" if (head != null && head.hasNext) true" , " if (head != null && head.nn.hasNext) true" )
753+ .replace(" head.next()" , " head.nn.next()" )
754+ .replace(
755+ " _root_.scala.collection.internal.pprint.CollectionName.get(i)" ,
756+ " import scala.reflect.Selectable.reflectiveSelectable\n " +
757+ " i.asInstanceOf[{def collectionClassName: String}].collectionClassName"
758+ )
759+ .replace(" abstract class Walker" , " @scala.annotation.nowarn abstract class Walker" )
760+ .replace(" object TPrintLowPri" , " @scala.annotation.nowarn object TPrintLowPri" )
761+ // .replace("_root_.scala.collection.internal.pprint.CollectionName.get(i)", "head.nn.next()")
762+ // .replace("_root_.scala.collection.internal.pprint.CollectionName.get(i)", "head.nn.next()")
763+ )
743764 file.toIO
744765 }
745766 }.taskValue,
0 commit comments