Skip to content

Commit 0141c1d

Browse files
committed
Remove methods that detected wrong classes loaded
Now we load them from their .tasty which ensures that the class was generated by Scala 3 (not Scala 2 nor Java).
1 parent 24f018d commit 0141c1d

File tree

5 files changed

+1
-47
lines changed

5 files changed

+1
-47
lines changed

compiler/src/dotty/tools/dotc/fromtasty/JavaCompilationUnit.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ class ReadTasty extends Phase {
4444
Some(unit)
4545
}
4646
case tree: Tree[?] =>
47+
// TODO handle correctly this case correctly to get the tree or avoid it completely.
4748
cls.denot.infoOrCompleter match {
48-
case _: NoLoader => Some(Scala2CompilationUnit(cls.fullName.toString))
49-
case _ if cls.flags.is(Flags.JavaDefined) => Some(JavaCompilationUnit(cls.fullName.toString))
5049
case _ => Some(AlreadyLoadedCompilationUnit(cls.denot.fullName.toString))
5150
}
5251
case _ =>

compiler/src/dotty/tools/dotc/fromtasty/Scala2CompilationUnit.scala

Lines changed: 0 additions & 13 deletions
This file was deleted.

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,15 +2585,6 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern
25852585

25862586
object Source extends SourceModule:
25872587
def path: java.nio.file.Path = ctx.compilationUnit.source.file.jpath
2588-
def isJavaCompilationUnit: Boolean = ctx.compilationUnit.isInstanceOf[dotc.fromtasty.JavaCompilationUnit]
2589-
def isScala2CompilationUnit: Boolean = ctx.compilationUnit.isInstanceOf[dotc.fromtasty.Scala2CompilationUnit]
2590-
def isAlreadyLoadedCompilationUnit: Boolean = ctx.compilationUnit.isInstanceOf[dotc.fromtasty.AlreadyLoadedCompilationUnit]
2591-
def compilationUnitClassname: String =
2592-
ctx.compilationUnit match
2593-
case cu: dotc.fromtasty.JavaCompilationUnit => cu.className
2594-
case cu: dotc.fromtasty.Scala2CompilationUnit => cu.className
2595-
case cu: dotc.fromtasty.AlreadyLoadedCompilationUnit => cu.className
2596-
case cu => ""
25972588
end Source
25982589

25992590
object Reporting extends ReportingModule:

library/src/scala/tasty/Reflection.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,17 +3265,6 @@ trait Reflection { reflection =>
32653265
/** Returns the source file being compiled. The path is relative to the current working directory. */
32663266
def path: java.nio.file.Path
32673267

3268-
/** Returns true if we've tried to reflect on a Java class. */
3269-
def isJavaCompilationUnit: Boolean
3270-
3271-
/** Returns true if we've tried to reflect on a Scala2 (non-Tasty) class. */
3272-
def isScala2CompilationUnit: Boolean
3273-
3274-
/** Returns true if we've tried to reflect on a class that's already loaded (e.g. Option). */
3275-
def isAlreadyLoadedCompilationUnit: Boolean
3276-
3277-
/** Class name of the current CompilationUnit */
3278-
def compilationUnitClassname: String
32793268
}
32803269

32813270
///////////////

0 commit comments

Comments
 (0)