get rid of deprecated usage of thread id to create temporary test output file names

This commit is contained in:
Irmen de Jong
2025-03-14 01:23:01 +01:00
parent 7668a3c660
commit 2c3d838dd8
4 changed files with 2 additions and 16 deletions

View File

@@ -91,8 +91,7 @@ main {
}
}
"""
@Suppress("DEPRECATION") // Thread.currentThread().id
val filenameBase = "on_the_fly_test_" + Thread.currentThread().id.toString() + "_" + sourceText.hashCode().toUInt().toString(16)
val filenameBase = "on_the_fly_test_${sourceText.hashCode().toUInt().toString(16)}"
val filepath = outputDir.resolve("$filenameBase.p8")
filepath.toFile().writeText(sourceText)

View File

@@ -61,8 +61,7 @@ internal fun compileText(
errors: IErrorReporter? = null,
writeAssembly: Boolean = true,
) : CompilationResult? {
@Suppress("DEPRECATION") // Thread.currentThread().id
val filePath = outputDir.resolve("on_the_fly_test_" + Thread.currentThread().id.toString() + "_" + sourceText.hashCode().toUInt().toString(16) + ".p8")
val filePath = outputDir.resolve("on_the_fly_test_${sourceText.hashCode().toUInt().toString(16)}.p8")
// we don't assumeNotExists(filePath) - should be ok to just overwrite it
filePath.toFile().writeText(sourceText)
return compileFile(platform, optimize, filePath.parent, filePath.name, outputDir,

View File

@@ -51,12 +51,3 @@ fun assumeDirectory(pathStr: String): Path = assumeDirectory(Path(pathStr))
fun assumeDirectory(path: Path, other: String): Path = assumeDirectory(path / other)
fun assumeDirectory(pathStr: String, other: String): Path = assumeDirectory(Path(pathStr) / other)
fun assumeDirectory(pathStr: String, other: Path): Path = assumeDirectory(Path(pathStr) / other)
@Deprecated(
"Directories are checked automatically at init.",
ReplaceWith("/* nothing */")
)
@Suppress("UNUSED_PARAMETER")
fun sanityCheckDirectories(workingDirName: String? = null) {
}