We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 890531d commit 68fc0c4Copy full SHA for 68fc0c4
tests/run/memoTest.scala
@@ -12,4 +12,24 @@ object Test extends App {
12
13
assert(foo(1) + foo(2) == 4)
14
assert(bar(1) + bar(2) == 4)
15
+
16
+ class Context(val n: Int)
17
+ def f(c: Context): Context = {
18
+ println("computing f")
19
+ Context(c.n + 1)
20
+ }
21
+ given as Context(0)
22
23
+ locally {
24
+ given as Context given (c: Context) = memo(f(c))
25
+ println(the[Context].n)
26
27
28
29
+ val ctx = f(the[Context])
30
31
+ given as Context = ctx
32
33
34
35
}
0 commit comments