|
1 | 1 | package scala.compiletime
|
| 2 | +package testing |
2 | 3 |
|
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") |
4 | 15 |
|
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