-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Safe val test #23533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Safe val test #23533
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,21 @@ class CompilationTests { | |
compileFilesInDir("tests/init-global/warn-tasty", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyExcludelisted)).checkWarnings() | ||
compileFilesInDir("tests/init-global/pos-tasty", defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings"), FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyExcludelisted)).checkCompile() | ||
end if | ||
locally { | ||
val tastyErrorGroup = TestGroup("checkInitGlobal/safe-value-tasty") | ||
val options = defaultOptions.and("-Wsafe-init", "-Xfatal-warnings", "-Ysafe-init-global") | ||
val tastyErrorOptions = options.without("-Xfatal-warnings") | ||
|
||
val outDirDef = defaultOutputDir + tastyErrorGroup + "/SafeValuesDef/safe-value-tasty/SafeValuesDef" | ||
|
||
val tests = List( | ||
compileFile("tests/init-global/pos-tasty/safe-value-tasty/def/SafeValuesDef.scala", tastyErrorOptions)(tastyErrorGroup), | ||
).map(_.keepOutput.checkCompile()) | ||
|
||
compileFile("tests/init-global/pos-tasty/safe-value-tasty/SafeValuesUse.scala", tastyErrorOptions.withClasspath(outDirDef))(tastyErrorGroup).checkCompile() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure the test is compiled with the option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no different effects. The test still passes. Added the change to a new commit below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the latest errors, it seems there is a problem with the class path:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't seem to be getting that issue on my end. I used to get that error before but my path was incorrect so perhaps try pulling again? I am running with ============================================================================ Test Report ============================================================================ 2 suites passed, 0 failed, 2 total |
||
|
||
tests.foreach(_.delete()) | ||
} | ||
} | ||
|
||
// initialization tests | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
object A { // These are safe values, so no warning should be emitted | ||
TestSafeValues.HashCodeLength | ||
TestSafeValues.BitPartitionSize | ||
TestSafeValues.MaxDepth | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
object TestSafeValues { | ||
val HashCodeLength = 32 | ||
val BitPartitionSize = 5 | ||
val MaxDepth = HashCodeLength.toDouble | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
object TestSafeValues { | ||
val HashCodeLength = 32 | ||
val BitPartitionSize = 5 | ||
val MaxDepth = HashCodeLength.toDouble | ||
} | ||
|
||
object A { // These are a safe values, so no warning should be emitted | ||
TestSafeValues.HashCodeLength | ||
TestSafeValues.BitPartitionSize | ||
TestSafeValues.MaxDepth | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package scala.collection.immutable | ||
|
||
object A { // These are a safe values, so no warning should be emitted | ||
Node.HashCodeLength | ||
Node.BitPartitionSize | ||
Node.MaxDepth | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be the correct directory path for the generated tasty files. I've found that
toDouble
in the tasty files has been regarded as method call trees in our checker, instead of selection trees before, so the test can pass now. Maybe the tasty disassembler has been updated and resolved this issue. There are no errors safe unexpected selections on base values in the latest logs, either.