diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-04 09:09:02 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-04 09:09:02 -0700 |
commit | 3b10725ee3a1f84855a0654c5e386bc7465816d3 (patch) | |
tree | deb6574654db3aab8c855a31c475c94233678a98 /core/src/test/scala/forge/TestGraphs.scala | |
parent | c5f3cb7fdcc610bd167460b75b22863f61d6fb4b (diff) | |
download | mill-3b10725ee3a1f84855a0654c5e386bc7465816d3.tar.gz mill-3b10725ee3a1f84855a0654c5e386bc7465816d3.tar.bz2 mill-3b10725ee3a1f84855a0654c5e386bc7465816d3.zip |
First experiment using `Cacher interface` combined with `Caller` implicits to turn `def foo = T{}` into pseudo-`lazy val`s, that we can override in subclasses using stackable traits
Diffstat (limited to 'core/src/test/scala/forge/TestGraphs.scala')
-rw-r--r-- | core/src/test/scala/forge/TestGraphs.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/core/src/test/scala/forge/TestGraphs.scala b/core/src/test/scala/forge/TestGraphs.scala index 0ee48a18..5960ed4c 100644 --- a/core/src/test/scala/forge/TestGraphs.scala +++ b/core/src/test/scala/forge/TestGraphs.scala @@ -1,5 +1,6 @@ package forge +import forge.Target.Cacher import forge.TestUtil.test class TestGraphs(){ @@ -42,6 +43,34 @@ class TestGraphs(){ val down = test(test(up), test(up)) } + object defCachedDiamond extends Cacher{ + def up = T{ test() } + def left = T{ test(up) } + def right = T{ test(up) } + def down = T{ test(left, right) } + } + + object borkedCachedDiamond1 { + def up = T{ test() } + def left = T{ test(up) } + def right = T{ test(up) } + def down = T{ test(left, right) } + } + + object borkedCachedDiamond2 extends Cacher { + def up = test() + def left = test(up) + def right = test(up) + def down = test(left, right) + } + + object borkedCachedDiamond3 { + def up = test() + def left = test(up) + def right = test(up) + def down = test(left, right) + } + // o g-----o // \ \ \ // o o h-----I---o |