Skip to content

Commit 1c7a847

Browse files
committed
Missing fun
1 parent 1d27d93 commit 1c7a847

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

proposals/context-parameters.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,15 +447,15 @@ class B { fun foo(x: Object) }
447447
// here 'foo' resolves to the one in 'B'
448448
// because 'B' is introduced in an inner scope
449449
// the fact that the one from 'A' is more specific doesn't play a role
450-
context(A) B.example1() = foo(5)
450+
context(A) fun B.example1() = foo(5)
451451

452452
// 'this' always resolves to 'B'
453-
context(A) B.example2() = this.foo(5)
453+
context(A) fun B.example2() = this.foo(5)
454454

455455
// to access the members from 'A' use a name, 'summon'
456-
context(A) B.example3a() = summon<A>().foo(5)
457-
context(a: A) B.example3b() = a.foo(5)
458-
context(a: A) B.example3b() = with(a) { foo(5) }
456+
context(A) fun B.example3a() = summon<A>().foo(5)
457+
context(a: A) fun B.example3b() = a.foo(5)
458+
context(a: A) fun B.example3b() = with(a) { foo(5) }
459459
```
460460

461461
**§29** *(resolution, most specific candidate)*: When choosing the **most specific candidate** we follow the Kotlin specification, with one addition:
@@ -514,7 +514,7 @@ class B { fun foo(x: Object) }
514514
// here 'foo' resolves to the one in 'A'
515515
// because both 'A' and 'B' are in the same scope
516516
// but the one from 'A' is more specific
517-
context(A) B.example1() = foo(5)
517+
context(A) fun B.example1() = foo(5)
518518
```
519519

520520
## Q&A about design decisions

0 commit comments

Comments
 (0)