@@ -447,15 +447,15 @@ class B { fun foo(x: Object) }
447
447
// here 'foo' resolves to the one in 'B'
448
448
// because 'B' is introduced in an inner scope
449
449
// 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 )
451
451
452
452
// 'this' always resolves to 'B'
453
- context(A ) B .example2() = this .foo(5 )
453
+ context(A ) fun B.example2 () = this .foo(5 )
454
454
455
455
// 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 ) }
459
459
```
460
460
461
461
** §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) }
514
514
// here 'foo' resolves to the one in 'A'
515
515
// because both 'A' and 'B' are in the same scope
516
516
// but the one from 'A' is more specific
517
- context(A ) B .example1() = foo(5 )
517
+ context(A ) fun B.example1 () = foo(5 )
518
518
```
519
519
520
520
## Q &A about design decisions
0 commit comments