Skip to content

Commit 8216d84

Browse files
Rid of compiletime.testing package object
Point the compiler to the compiletime.testing package instead of package object
1 parent 8ec754f commit 8216d84

File tree

3 files changed

+32
-34
lines changed

3 files changed

+32
-34
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ class Definitions {
231231
@tu lazy val Compiletime_constValue : Symbol = CompiletimePackageObject.requiredMethod("constValue")
232232
@tu lazy val Compiletime_constValueOpt: Symbol = CompiletimePackageObject.requiredMethod("constValueOpt")
233233
@tu lazy val Compiletime_summonFrom : Symbol = CompiletimePackageObject.requiredMethod("summonFrom")
234-
@tu lazy val CompiletimeTestingPackageObject: Symbol = requiredModule("scala.compiletime.testing.package")
235-
@tu lazy val CompiletimeTesting_typeChecks: Symbol = CompiletimeTestingPackageObject.requiredMethod("typeChecks")
236-
@tu lazy val CompiletimeTesting_typeCheckErrors: Symbol = CompiletimeTestingPackageObject.requiredMethod("typeCheckErrors")
234+
@tu lazy val CompiletimeTestingPackage: Symbol = requiredPackage("scala.compiletime.testing")
235+
@tu lazy val CompiletimeTesting_typeChecks: Symbol = CompiletimeTestingPackage.requiredMethod("typeChecks")
236+
@tu lazy val CompiletimeTesting_typeCheckErrors: Symbol = CompiletimeTestingPackage.requiredMethod("typeCheckErrors")
237237
@tu lazy val CompiletimeTesting_ErrorClass: ClassSymbol = requiredClass("scala.compiletime.testing.Error")
238238
@tu lazy val CompiletimeTesting_Error: Symbol = requiredModule("scala.compiletime.testing.Error")
239239
@tu lazy val CompiletimeTesting_Error_apply = CompiletimeTesting_Error.requiredMethod(nme.apply)

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ object Inliner {
7272
*/
7373
def inlineCall(tree: Tree)(using Context): Tree = {
7474
if tree.symbol.denot != SymDenotations.NoDenotation
75-
&& tree.symbol.owner.companionModule == defn.CompiletimeTestingPackageObject
75+
&& tree.symbol.effectiveOwner == defn.CompiletimeTestingPackage.moduleClass
7676
then
7777
if (tree.symbol == defn.CompiletimeTesting_typeChecks) return Intrinsics.typeChecks(tree)
7878
if (tree.symbol == defn.CompiletimeTesting_typeCheckErrors) return Intrinsics.typeCheckErrors(tree)
Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
package scala.compiletime
2+
package testing
23

3-
package object testing {
4+
/** Whether the code type checks in the current context?
5+
*
6+
* @param code The code to be type checked
7+
*
8+
* @return false if the code has syntax error or type error in the current context, otherwise returns true.
9+
*
10+
* The code should be a sequence of expressions or statements that may appear in a block.
11+
*/
12+
inline def typeChecks(inline code: String): Boolean =
13+
// implemented in package dotty.tools.dotc.typer.Inliner.Intrinsics
14+
error("Compiler bug: `typeChecks` was not checked by the compiler")
415

5-
/** Whether the code type checks in the current context?
6-
*
7-
* @param code The code to be type checked
8-
*
9-
* @return false if the code has syntax error or type error in the current context, otherwise returns true.
10-
*
11-
* The code should be a sequence of expressions or statements that may appear in a block.
12-
*/
13-
inline def typeChecks(inline code: String): Boolean =
14-
// implemented in package dotty.tools.dotc.typer.Inliner.Intrinsics
15-
error("Compiler bug: `typeChecks` was not checked by the compiler")
16-
17-
/** Whether the code type checks in the current context? If not,
18-
* returns a list of errors encountered on compilation.
19-
* IMPORTANT: No stability guarantees are provided on the format of these
20-
* errors. This means the format and the API may change from
21-
* version to version. This API is to be used for testing purposes
22-
* only.
23-
*
24-
* @param code The code to be type checked
25-
*
26-
* @return a list of errors encountered during parsing and typechecking.
27-
*
28-
* The code should be a sequence of expressions or statements that may appear in a block.
29-
*/
30-
inline def typeCheckErrors(inline code: String): List[Error] =
31-
// implemented in package dotty.tools.dotc.typer.Inliner.Intrinsics
32-
error("Compiler bug: `typeCheckErrors` was not checked by the compiler")
33-
}
16+
/** Whether the code type checks in the current context? If not,
17+
* returns a list of errors encountered on compilation.
18+
* IMPORTANT: No stability guarantees are provided on the format of these
19+
* errors. This means the format and the API may change from
20+
* version to version. This API is to be used for testing purposes
21+
* only.
22+
*
23+
* @param code The code to be type checked
24+
*
25+
* @return a list of errors encountered during parsing and typechecking.
26+
*
27+
* The code should be a sequence of expressions or statements that may appear in a block.
28+
*/
29+
inline def typeCheckErrors(inline code: String): List[Error] =
30+
// implemented in package dotty.tools.dotc.typer.Inliner.Intrinsics
31+
error("Compiler bug: `typeCheckErrors` was not checked by the compiler")

0 commit comments

Comments
 (0)