forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#5767 from milessabin/topic/i5766
Correct owner chains when mixing byname implicits and inlining
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
object Test1 { | ||
trait Foo { def next: Foo } | ||
|
||
inline implicit def foo(implicit loop: => Foo): Foo = new Foo { def next = loop } | ||
|
||
def summon(implicit f: Foo) = () | ||
summon | ||
} | ||
|
||
object Test2 { | ||
trait Foo { def next: Bar } | ||
trait Bar { def next: Foo } | ||
|
||
implicit def foo(implicit loop: => Bar): Foo = new Foo { def next = loop } | ||
inline implicit def bar(implicit loop: Foo): Bar = new Bar { def next = loop } | ||
|
||
def summon(implicit f: Foo) = () | ||
summon | ||
} | ||
|
||
object Test3 { | ||
trait Foo { def next: Bar } | ||
trait Bar { def next: Baz } | ||
trait Baz { def next: Foo } | ||
|
||
implicit def foo(implicit loop: Bar): Foo = new Foo { def next = loop } | ||
inline implicit def bar(implicit loop: Baz): Bar = new Bar { def next = loop } | ||
inline implicit def baz(implicit loop: => Foo): Baz = new Baz { def next = loop } | ||
|
||
def summon(implicit f: Foo) = () | ||
summon | ||
} |