Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-44407][BUILD][TESTS] Clean up the compilation warnings related…
… to `it will become a keyword in Scala 3` and prohibit use these keywords as variable name ### What changes were proposed in this pull request? This pr clean up the compilation warnings related to `it will become a keyword in Scala 3`, additionally, to facilitate future Scala version migration, a new compiler option has been added to prohibit the use of these keywords as variable names. ### Why are the changes needed? There are some literals, such as `enum`, `given`, `export`, etc., using them as variable names in Scala 2.13 will trigger compilation warnings, but this will become a compilation error in Scala 3. **Scala 2.13** ``` Welcome to Scala 2.13.12 (OpenJDK 64-Bit Server VM, Java 17.0.8). Type in expressions for evaluation. Or try :help. scala> val enum: Int = 1 ^ warning: Wrap `enum` in backticks to use it as an identifier, it will become a keyword in Scala 3. [quickfixable] val enum: Int = 1 scala> val export: Int = 1 ^ warning: Wrap `export` in backticks to use it as an identifier, it will become a keyword in Scala 3. [quickfixable] val export: Int = 1 scala> val given: Int = 1 ^ warning: Wrap `given` in backticks to use it as an identifier, it will become a keyword in Scala 3. [quickfixable] val given: Int = 1 ``` **Scala 3** ``` Welcome to Scala 3.3.1 (17.0.8, Java OpenJDK 64-Bit Server VM). Type in expressions for evaluation. Or try :help. scala> val enum: Int = 1 -- [E032] Syntax Error: -------------------------------------------------------- 1 |val enum: Int = 1 | ^^^^ | pattern expected | | longer explanation available when compiling with `-explain` scala> val export: Int = 1 -- [E032] Syntax Error: -------------------------------------------------------- 1 |val export: Int = 1 | ^^^^^^ | pattern expected | | longer explanation available when compiling with `-explain` scala> val given: Int = 1 -- [E040] Syntax Error: -------------------------------------------------------- 1 |val given: Int = 1 | ^ | an identifier expected, but ':' found | | longer explanation available when compiling with `-explain` ``` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GitHub Actions ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#43529 from LuciferYang/SPARK-44407. Authored-by: yangjie01 <[email protected]> Signed-off-by: yangjie01 <[email protected]>
- Loading branch information