Open scabug opened 8 years ago
Imported From: https://issues.scala-lang.org/browse/SI-9755?orig=1 Reporter: Artyom Kozhemiakin (akozhemiakin) Affected Versions: 2.11.8, 2.12.0-M3
@som-snytt said: In sbt, it fails after clean, then succeeds subsequently (on editing the test file). I see the same behavior using a Java annotation or ClassfileAnnotation, and also after putting the macro and test in different subprojects.
> clean
[success] Total time: 0 s, completed Apr 15, 2016 9:51:14 AM
> ~ test
[info] Updating {file:/home/apm/tmp/sandbox-one/}sandbox...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/apm/tmp/sandbox-one/target/scala-2.11/classes...
[info] Compiling 4 Scala sources and 1 Java source to /home/apm/tmp/sandbox-one/target/scala-2.11/test-classes...
[info] SandboxSpec:
[info] - Test 1
[info] - Test 2 *** FAILED ***
[info] 0 did not equal 1 (SandboxSpec.scala:16)
[info] Run completed in 249 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error] sandbox.SandboxSpec
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 6 s, completed Apr 15, 2016 9:51:24 AM
1. Waiting for source changes... (press enter to interrupt)
[info] Compiling 1 Scala source to /home/apm/tmp/sandbox-one/target/scala-2.11/test-classes...
[info] SandboxSpec:
[info] - Test 1
[info] - Test 2
[info] - Dummy
[info] Run completed in 137 milliseconds.
[info] Total number of tests run: 3
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 3, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 2 s, completed Apr 15, 2016 9:51:33 AM
Artyom Kozhemiakin (akozhemiakin) said: Yeah, I faced very similar thing while debugging. From time to time it may be compiled successfully without any obvious reason but then fails again.
@som-snytt said: Worked for me today by switching the order of the tests. annotations and imports have unusual completion needs. Maybe the import is a clue.
I faced pretty strange annotations-related behavior (bug?) with scala macro. Its pretty hard to describe it in one message so I decided to create a sample repo to show it.
https://github.com/akozhemiakin/sandbox-one
In brief, here is the test itself:
So the problem is, that in the second case scala does not see any annotations attached to the target method.
I did my best to find some similar issue but did not succeed, hope it is not a duplicate.