Skip to content

Commit

Permalink
Added test case for issue #2107
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Jan 21, 2023
1 parent 789fffc commit 8deaf6c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
22 changes: 21 additions & 1 deletion main/test/src/eval/EvaluationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class EvaluationTests(threadCount: Option[Int]) extends TestSuite {
// the main publicly-available command
import StackableOverrides._

val checker = new Checker(canOverrideSuper)
val checker = new Checker(StackableOverrides)
checker(
m.f,
6,
Expand All @@ -382,5 +382,25 @@ class EvaluationTests(threadCount: Option[Int]) extends TestSuite {
)
assert(os.read(checker.evaluator.outPath / "m" / "f.json").contains(" 6,"))
}
"privateTasksInMixedTraits" - {
// Make sure we can have private cached targets in different trait with the same name,
// and caching still works when these traits are mixed together
import PrivateTasksInMixedTraits._
val checker = new Checker(PrivateTasksInMixedTraits)
checker(
mod.bar,
"foo-m1",
Agg(mod.bar),
extraEvaled = -1
)
// If we evaluate to "foo-m1" instead of "foo-m2",
// we don't properly distinguish between the two private `foo` targets
checker(
mod.baz,
"foo-m2",
Agg(mod.baz),
extraEvaled = -1
)
}
}
}
12 changes: 12 additions & 0 deletions main/test/src/util/TestGraphs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,16 @@ object TestGraphs {
}
object m extends A with B {}
}

object PrivateTasksInMixedTraits extends TestUtil.BaseModule {
trait M1 extends Module {
private def foo = T { "foo-m1" }
def bar = T { foo() }
}
trait M2 extends Module {
private def foo = T { "foo-m2" }
def baz = T { foo() }
}
object mod extends M1 with M2
}
}

0 comments on commit 8deaf6c

Please sign in to comment.