-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from AVSystem/scala-2.13.14-hash-code-fix
Fixed infinite background compilation in scala 2.13.14
- Loading branch information
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
scex-core/src/test/scala/com/avsystem/scex/compiler/OufOfDateUnitScexCompilerTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.avsystem.scex.compiler | ||
|
||
import com.avsystem.scex.compiler.presentation.ScexPresentationCompiler | ||
import com.avsystem.scex.japi.{JavaScexCompiler, ScalaTypeTokens} | ||
import com.avsystem.scex.util.{PredefinedAccessSpecs, SimpleContext} | ||
import org.scalatest.funsuite.AnyFunSuite | ||
|
||
class OufOfDateUnitScexCompilerTest extends AnyFunSuite with CompilationTest { | ||
|
||
override protected def createCompiler: noCacheCompiler.type = noCacheCompiler | ||
|
||
object noCacheCompiler | ||
extends ScexCompiler | ||
with ScexPresentationCompiler | ||
with JavaScexCompiler | ||
with ClassfileReusingScexCompiler { | ||
|
||
val settings = new ScexSettings | ||
settings.classfileDirectory.value = "testClassfileCache" | ||
} | ||
|
||
/** * | ||
* Purpose of this test it to compile same expression using same profile multiple times with disabled caching to force execution of backgroundCompile method | ||
* backgroundCompile was infinitely executed with changes introduced by 2.13.13 | ||
*/ | ||
test("out of date compilation") { | ||
val acl = PredefinedAccessSpecs.basicOperations | ||
val profile = createProfile(acl) | ||
|
||
def compileExpression(): Unit = { | ||
compiler.buildExpression | ||
.contextType(ScalaTypeTokens.create[SimpleContext[Unit]]) | ||
.resultType(classOf[String]) | ||
.expression(s""""value"""") | ||
.template(false) | ||
.profile(profile) | ||
.get | ||
} | ||
|
||
compileExpression() | ||
compileExpression() | ||
} | ||
|
||
|
||
} |