Skip to content

Commit

Permalink
Merge branch 'change-extmethods3' of https://github.com/dotty-staging…
Browse files Browse the repository at this point in the history
…/dotty into change-extmethods3
  • Loading branch information
odersky committed Jan 13, 2020
2 parents a89a9cc + 74e56a0 commit c96e7c2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 52 deletions.
4 changes: 2 additions & 2 deletions tests/semanticdb/expect/Enums.expect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ object Enums/*<-_empty_::Enums.*/ with
case Hearts/*<-_empty_::Enums.Suits.Hearts.*/, Spades/*<-_empty_::Enums.Suits.Spades.*/, Clubs/*<-_empty_::Enums.Suits.Clubs.*/, Diamonds/*<-_empty_::Enums.Suits.Diamonds.*/

object Suits/*<-_empty_::Enums.Suits.*/ with
def (suit/*<-_empty_::Enums.Suits.isRed().*//*<-_empty_::Enums.Suits.isRed().(suit)*/: Suits/*->_empty_::Enums.Suits#*/) isRed: Boolean/*->scala::Boolean#*/ =
def (suit/*<-_empty_::Enums.Suits.isRed().*//*<-_empty_::Enums.Suits.isRed().(suit)*/: Suits/*->_empty_::Enums.Suits#*/).isRed: Boolean/*->scala::Boolean#*/ =
suit/*->_empty_::Enums.Suits.isRed().(suit)*/ ==/*->scala::Any#`==`().*/ Hearts/*->_empty_::Enums.Suits.Hearts.*/ ||/*->scala::Boolean#`||`().*/ suit/*->_empty_::Enums.Suits.isRed().(suit)*/ ==/*->scala::Any#`==`().*/ Diamonds/*->_empty_::Enums.Suits.Diamonds.*/

def (suit: /*<-_empty_::Enums.Suits.isBlack().*//*<-_empty_::Enums.Suits.isBlack().(suit)*/Suits/*->_empty_::Enums.Suits#*/) isBlack: Boolean/*->scala::Boolean#*/ = suit/*->_empty_::Enums.Suits.isBlack().(suit)*/ match
def (suit: /*<-_empty_::Enums.Suits.isBlack().*//*<-_empty_::Enums.Suits.isBlack().(suit)*/Suits/*->_empty_::Enums.Suits#*/).isBlack: Boolean/*->scala::Boolean#*/ = suit/*->_empty_::Enums.Suits.isBlack().(suit)*/ match
case Spades/*->_empty_::Enums.Suits.Spades.*/ | Diamonds/*->_empty_::Enums.Suits.Diamonds.*/ => true
case _ => false

Expand Down
20 changes: 10 additions & 10 deletions tests/semanticdb/expect/Givens.expect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ package b

object Givens/*<-a::b::Givens.*/

given extension [A](any: /*<-a::b::Givens.given_sayHello_of_A.*//*<-a::b::Givens.given_sayHello_of_A.sayHello().[A]*//*<-a::b::Givens.given_sayHello_of_A.sayHello().(any)*/A/*->a::b::Givens.given_sayHello_of_A.sayHello().[A]*/)
def sayHello/*<-a::b::Givens.given_sayHello_of_A.sayHello().*/ = s"/*->scala::StringContext.apply().*/Hello, I am $any/*->a::b::Givens.given_sayHello_of_A.sayHello().(any)*//*->scala::StringContext#s().*/"
given extension [A](any: A/*<-a::b::Givens.extension_sayHello_A.*//*<-a::b::Givens.extension_sayHello_A.sayHello().[A]*//*<-a::b::Givens.extension_sayHello_A.sayHello().(any)*//*->a::b::Givens.extension_sayHello_A.sayHello().[A]*/)
def sayHello/*<-a::b::Givens.extension_sayHello_A.sayHello().*/ = s"/*->scala::StringContext.apply().*/Hello, I am $any/*->a::b::Givens.extension_sayHello_A.sayHello().(any)*//*->scala::StringContext#s().*/"

given extension [B](any: B)/*<-a::b::Givens.given_sayGoodbye_of_B.*//*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().[B]*//*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().[B]*//*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().(any)*//*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().(any)*//*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().[B]*//*->a::b::Givens.given_sayGoodbye_of_B.saySoLong().[B]*/
def sayGoodbye/*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().*/ = s"/*->scala::StringContext.apply().*/Goodbye, from $any/*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().(any)*//*->scala::StringContext#s().*/"
def saySoLong/*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().*/ = s"/*->scala::StringContext.apply().*/So Long, from $any/*->a::b::Givens.given_sayGoodbye_of_B.saySoLong().(any)*//*->scala::StringContext#s().*/"
given extension [B](any: B)
/*<-a::b::Givens.extension_sayGoodbye_B.*//*<-a::b::Givens.extension_sayGoodbye_B.sayGoodbye().[B]*//*<-a::b::Givens.extension_sayGoodbye_B.saySoLong().[B]*//*<-a::b::Givens.extension_sayGoodbye_B.sayGoodbye().(any)*//*<-a::b::Givens.extension_sayGoodbye_B.saySoLong().(any)*//*->a::b::Givens.extension_sayGoodbye_B.sayGoodbye().[B]*//*->a::b::Givens.extension_sayGoodbye_B.saySoLong().[B]*/ def sayGoodbye/*<-a::b::Givens.extension_sayGoodbye_B.sayGoodbye().*/ = s"/*->scala::StringContext.apply().*/Goodbye, from $any/*->a::b::Givens.extension_sayGoodbye_B.sayGoodbye().(any)*//*->scala::StringContext#s().*/"
def saySoLong/*<-a::b::Givens.extension_sayGoodbye_B.saySoLong().*/ = s"/*->scala::StringContext.apply().*/So Long, from $any/*->a::b::Givens.extension_sayGoodbye_B.saySoLong().(any)*//*->scala::StringContext#s().*/"

val hello1/*<-a::b::Givens.hello1.*/ = /*->a::b::Givens.given_sayHello_of_A.sayHello().*/1.sayHello
val goodbye1/*<-a::b::Givens.goodbye1.*/ = /*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().*/1.sayGoodbye
val soLong1/*<-a::b::Givens.soLong1.*/ = /*->a::b::Givens.given_sayGoodbye_of_B.saySoLong().*/1.saySoLong
val hello1/*<-a::b::Givens.hello1.*/ = /*->a::b::Givens.extension_sayHello_A.sayHello().*/1.sayHello
val goodbye1/*<-a::b::Givens.goodbye1.*/ = /*->a::b::Givens.extension_sayGoodbye_B.sayGoodbye().*/1.sayGoodbye
val soLong1/*<-a::b::Givens.soLong1.*/ = /*->a::b::Givens.extension_sayGoodbye_B.saySoLong().*/1.saySoLong

trait Monoid/*<-a::b::Givens.Monoid#*/[A/*<-a::b::Givens.Monoid#[A]*/]
def empty/*<-a::b::Givens.Monoid#empty().*/: A/*->a::b::Givens.Monoid#[A]*/
def (x: A) /*<-a::b::Givens.Monoid#combine().*//*<-a::b::Givens.Monoid#combine().(x)*//*->a::b::Givens.Monoid#[A]*/combine (y/*<-a::b::Givens.Monoid#combine().(y)*/: A/*->a::b::Givens.Monoid#[A]*/): A/*->a::b::Givens.Monoid#[A]*/
def (x: A)./*<-a::b::Givens.Monoid#combine().*//*<-a::b::Givens.Monoid#combine().(x)*//*->a::b::Givens.Monoid#[A]*/combine(y/*<-a::b::Givens.Monoid#combine().(y)*/: A/*->a::b::Givens.Monoid#[A]*/): A/*->a::b::Givens.Monoid#[A]*/

given Monoid[String]
/*<-a::b::Givens.given_Monoid_String.*//*->a::b::Givens.Monoid#*//*->scala::Predef.String#*/def empty/*<-a::b::Givens.given_Monoid_String.empty().*/ = ""
def (x: Str/*<-a::b::Givens.given_Monoid_String.combine().*//*<-a::b::Givens.given_Monoid_String.combine().(x)*/ing/*->scala::Predef.String#*/) combine (y/*<-a::b::Givens.given_Monoid_String.combine().(y)*/: String/*->scala::Predef.String#*/) = x/*->a::b::Givens.given_Monoid_String.combine().(x)*/ +/*->java::lang::String#`+`().*/ y/*->a::b::Givens.given_Monoid_String.combine().(y)*/
def (x: Str/*<-a::b::Givens.given_Monoid_String.combine().*//*<-a::b::Givens.given_Monoid_String.combine().(x)*/ing/*->scala::Predef.String#*/).combine(y/*<-a::b::Givens.given_Monoid_String.combine().(y)*/: String/*->scala::Predef.String#*/) = x/*->a::b::Givens.given_Monoid_String.combine().(x)*/ +/*->java::lang::String#`+`().*/ y/*->a::b::Givens.given_Monoid_String.combine().(y)*/

inline given int2String/*<-a::b::Givens.int2String().*/: Conversion/*->scala::Conversion#*/[Int/*->scala::Int#*/, String/*->scala::Predef.String#*/] = _.toString/*->scala::Any#toString().*/

Expand Down
81 changes: 41 additions & 40 deletions tests/semanticdb/metac.expect
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,17 @@ a/b/Givens.Monoid#combine(). => abstract method combine
a/b/Givens.Monoid#combine().(x) => param x
a/b/Givens.Monoid#combine().(y) => param y
a/b/Givens.Monoid#empty(). => abstract method empty
a/b/Givens.extension_sayGoodbye_B. => final implicit object extension_sayGoodbye_B
a/b/Givens.extension_sayGoodbye_B.sayGoodbye(). => method sayGoodbye
a/b/Givens.extension_sayGoodbye_B.sayGoodbye().(any) => param any
a/b/Givens.extension_sayGoodbye_B.sayGoodbye().[B] => typeparam B
a/b/Givens.extension_sayGoodbye_B.saySoLong(). => method saySoLong
a/b/Givens.extension_sayGoodbye_B.saySoLong().(any) => param any
a/b/Givens.extension_sayGoodbye_B.saySoLong().[B] => typeparam B
a/b/Givens.extension_sayHello_A. => final implicit object extension_sayHello_A
a/b/Givens.extension_sayHello_A.sayHello(). => method sayHello
a/b/Givens.extension_sayHello_A.sayHello().(any) => param any
a/b/Givens.extension_sayHello_A.sayHello().[A] => typeparam A
a/b/Givens.foo(). => method foo
a/b/Givens.foo().(A) => implicit param A
a/b/Givens.foo().[A] => typeparam A
Expand All @@ -1288,17 +1299,6 @@ a/b/Givens.given_Monoid_String.combine(). => method combine
a/b/Givens.given_Monoid_String.combine().(x) => param x
a/b/Givens.given_Monoid_String.combine().(y) => param y
a/b/Givens.given_Monoid_String.empty(). => method empty
a/b/Givens.given_sayGoodbye_of_B. => final implicit object given_sayGoodbye_of_B
a/b/Givens.given_sayGoodbye_of_B.sayGoodbye(). => method sayGoodbye
a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().(any) => param any
a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B] => typeparam B
a/b/Givens.given_sayGoodbye_of_B.saySoLong(). => method saySoLong
a/b/Givens.given_sayGoodbye_of_B.saySoLong().(any) => param any
a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B] => typeparam B
a/b/Givens.given_sayHello_of_A. => final implicit object given_sayHello_of_A
a/b/Givens.given_sayHello_of_A.sayHello(). => method sayHello
a/b/Givens.given_sayHello_of_A.sayHello().(any) => param any
a/b/Givens.given_sayHello_of_A.sayHello().[A] => typeparam A
a/b/Givens.goodbye1. => val method goodbye1
a/b/Givens.hello1. => val method hello1
a/b/Givens.int2String(). => final implicit macro int2String
Expand All @@ -1308,58 +1308,58 @@ Occurrences:
[0:8..0:9): a <- a/
[1:8..1:9): b <- a/b/
[3:7..3:13): Givens <- a/b/Givens.
[5:8..5:27): extension [A](any: <- a/b/Givens.given_sayHello_of_A.
[5:19..5:20): A <- a/b/Givens.given_sayHello_of_A.sayHello().[A]
[5:22..5:25): any <- a/b/Givens.given_sayHello_of_A.sayHello().(any)
[5:27..5:28): A -> a/b/Givens.given_sayHello_of_A.sayHello().[A]
[6:8..6:16): sayHello <- a/b/Givens.given_sayHello_of_A.sayHello().
[5:8..5:28): extension [A](any: A <- a/b/Givens.extension_sayHello_A.
[5:19..5:20): A <- a/b/Givens.extension_sayHello_A.sayHello().[A]
[5:22..5:25): any <- a/b/Givens.extension_sayHello_A.sayHello().(any)
[5:27..5:28): A -> a/b/Givens.extension_sayHello_A.sayHello().[A]
[6:8..6:16): sayHello <- a/b/Givens.extension_sayHello_A.sayHello().
[6:21..6:21): -> scala/StringContext.apply().
[6:34..6:37): any -> a/b/Givens.given_sayHello_of_A.sayHello().(any)
[6:34..6:37): any -> a/b/Givens.extension_sayHello_A.sayHello().(any)
[6:37..6:37): -> scala/StringContext#s().
[8:8..8:29): extension [B](any: B) <- a/b/Givens.given_sayGoodbye_of_B.
[8:19..8:20): B <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B]
[8:19..8:20): B <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B]
[8:22..8:25): any <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().(any)
[8:22..8:25): any <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().(any)
[8:27..8:28): B -> a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B]
[8:27..8:28): B -> a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B]
[9:8..9:18): sayGoodbye <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().
[8:8..9:0): <- a/b/Givens.extension_sayGoodbye_B.
[8:19..8:20): B <- a/b/Givens.extension_sayGoodbye_B.sayGoodbye().[B]
[8:19..8:20): B <- a/b/Givens.extension_sayGoodbye_B.saySoLong().[B]
[8:22..8:25): any <- a/b/Givens.extension_sayGoodbye_B.sayGoodbye().(any)
[8:22..8:25): any <- a/b/Givens.extension_sayGoodbye_B.saySoLong().(any)
[8:27..8:28): B -> a/b/Givens.extension_sayGoodbye_B.sayGoodbye().[B]
[8:27..8:28): B -> a/b/Givens.extension_sayGoodbye_B.saySoLong().[B]
[9:8..9:18): sayGoodbye <- a/b/Givens.extension_sayGoodbye_B.sayGoodbye().
[9:23..9:23): -> scala/StringContext.apply().
[9:38..9:41): any -> a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().(any)
[9:38..9:41): any -> a/b/Givens.extension_sayGoodbye_B.sayGoodbye().(any)
[9:41..9:41): -> scala/StringContext#s().
[10:8..10:17): saySoLong <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().
[10:8..10:17): saySoLong <- a/b/Givens.extension_sayGoodbye_B.saySoLong().
[10:22..10:22): -> scala/StringContext.apply().
[10:37..10:40): any -> a/b/Givens.given_sayGoodbye_of_B.saySoLong().(any)
[10:37..10:40): any -> a/b/Givens.extension_sayGoodbye_B.saySoLong().(any)
[10:40..10:40): -> scala/StringContext#s().
[12:6..12:12): hello1 <- a/b/Givens.hello1.
[12:15..12:15): -> a/b/Givens.given_sayHello_of_A.sayHello().
[12:15..12:15): -> a/b/Givens.extension_sayHello_A.sayHello().
[13:6..13:14): goodbye1 <- a/b/Givens.goodbye1.
[13:17..13:17): -> a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().
[13:17..13:17): -> a/b/Givens.extension_sayGoodbye_B.sayGoodbye().
[14:6..14:13): soLong1 <- a/b/Givens.soLong1.
[14:16..14:16): -> a/b/Givens.given_sayGoodbye_of_B.saySoLong().
[14:16..14:16): -> a/b/Givens.extension_sayGoodbye_B.saySoLong().
[16:8..16:14): Monoid <- a/b/Givens.Monoid#
[16:14..16:17): <- a/b/Givens.Monoid#`<init>`().
[16:15..16:16): A <- a/b/Givens.Monoid#[A]
[17:8..17:13): empty <- a/b/Givens.Monoid#empty().
[17:15..17:16): A -> a/b/Givens.Monoid#[A]
[18:8..18:15): (x: A) <- a/b/Givens.Monoid#combine().
[18:8..18:15): (x: A). <- a/b/Givens.Monoid#combine().
[18:9..18:10): x <- a/b/Givens.Monoid#combine().(x)
[18:12..18:13): A -> a/b/Givens.Monoid#[A]
[18:24..18:25): y <- a/b/Givens.Monoid#combine().(y)
[18:27..18:28): A -> a/b/Givens.Monoid#[A]
[18:31..18:32): A -> a/b/Givens.Monoid#[A]
[18:23..18:24): y <- a/b/Givens.Monoid#combine().(y)
[18:26..18:27): A -> a/b/Givens.Monoid#[A]
[18:30..18:31): A -> a/b/Givens.Monoid#[A]
[20:8..21:4): <- a/b/Givens.given_Monoid_String.
[20:8..20:14): Monoid -> a/b/Givens.Monoid#
[20:15..20:21): String -> scala/Predef.String#
[21:8..21:13): empty <- a/b/Givens.given_Monoid_String.empty().
[22:8..22:15): (x: Str <- a/b/Givens.given_Monoid_String.combine().
[22:9..22:10): x <- a/b/Givens.given_Monoid_String.combine().(x)
[22:12..22:18): String -> scala/Predef.String#
[22:29..22:30): y <- a/b/Givens.given_Monoid_String.combine().(y)
[22:32..22:38): String -> scala/Predef.String#
[22:42..22:43): x -> a/b/Givens.given_Monoid_String.combine().(x)
[22:44..22:45): + -> java/lang/String#`+`().
[22:46..22:47): y -> a/b/Givens.given_Monoid_String.combine().(y)
[22:28..22:29): y <- a/b/Givens.given_Monoid_String.combine().(y)
[22:31..22:37): String -> scala/Predef.String#
[22:41..22:42): x -> a/b/Givens.given_Monoid_String.combine().(x)
[22:43..22:44): + -> java/lang/String#`+`().
[22:45..22:46): y -> a/b/Givens.given_Monoid_String.combine().(y)
[24:15..24:25): int2String <- a/b/Givens.int2String().
[24:27..24:37): Conversion -> scala/Conversion#
[24:38..24:41): Int -> scala/Int#
Expand Down Expand Up @@ -3565,3 +3565,4 @@ Occurrences:
[2:46..2:47): z -> _empty_/toplevel$package.combine(+1).(z)
[3:4..3:11): combine <- _empty_/toplevel$package.combine(+2).
[4:4..4:7): foo <- _empty_/toplevel$package.foo().

0 comments on commit c96e7c2

Please sign in to comment.