forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 1
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#3237 from xeno-by/topic/macrodef-returntype-…
…inference deprecates macro def return type inference
- Loading branch information
Showing
102 changed files
with
245 additions
and
235 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
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 |
---|---|---|
|
@@ -11,5 +11,5 @@ object Macros { | |
""" | ||
} | ||
|
||
def foo = macro impl | ||
def foo: Any = macro impl | ||
} |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
-language:experimental.macros | ||
-language:experimental.macros | ||
-Xfatal-warnings | ||
-deprecation |
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 |
---|---|---|
@@ -1,10 +1,18 @@ | ||
object Macros { | ||
def foo1 = macro Impls.foo1 | ||
def foo2 = macro Impls.foo2 | ||
def foo3 = macro Impls.foo3 | ||
def foo4 = macro ??? | ||
def foo5 = macro Impls.foo5 | ||
def foo6 = macro Impls.foo6 | ||
} | ||
|
||
object Test extends App { | ||
import Macros._ | ||
foo1 | ||
foo2 | ||
foo3 | ||
foo4 | ||
foo5 | ||
foo6 | ||
} |
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
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
2 changes: 1 addition & 1 deletion
2
test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala
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
12 changes: 7 additions & 5 deletions
12
test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala
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
2 changes: 1 addition & 1 deletion
2
test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
object Macros { | ||
def foo = macro Impls.foo | ||
def foo: Unit = macro Impls.foo | ||
} | ||
|
||
object Test extends App { | ||
|
2 changes: 1 addition & 1 deletion
2
test/files/neg/macro-override-macro-overrides-abstract-method-a.check
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int; | ||
macro method foo cannot be used here - term macros cannot override abstract methods | ||
def foo(x: Int) = macro Impls.impl | ||
def foo(x: Int): Int = macro Impls.impl | ||
^ | ||
one error found |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit; | ||
method foo cannot be used here - only term macros can override term macros | ||
override def foo(x: String) = println("fooDString") | ||
override def foo(x: String): Unit = println("fooDString") | ||
^ | ||
one error found |
14 changes: 7 additions & 7 deletions
14
test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
class B { | ||
def foo(x: String) = macro Impls.fooBString | ||
def foo(x: Int) = macro Impls.fooBInt | ||
def foo(x: Boolean) = println("fooBBoolean") | ||
def foo(x: String): Unit = macro Impls.fooBString | ||
def foo(x: Int): Unit = macro Impls.fooBInt | ||
def foo(x: Boolean): Unit = println("fooBBoolean") | ||
} | ||
|
||
class D extends B { | ||
override def foo(x: String) = println("fooDString") | ||
override def foo(x: Int) = macro Impls.fooDInt | ||
override def foo(x: String): Unit = println("fooDString") | ||
override def foo(x: Int): Unit = macro Impls.fooDInt | ||
} | ||
|
||
class Z extends D { | ||
override def foo(x: String) = macro Impls.fooZString | ||
override def foo(x: Boolean) = println("fooZBoolean") | ||
override def foo(x: String): Unit = macro Impls.fooZString | ||
override def foo(x: Boolean): Unit = println("fooZBoolean") | ||
} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Macros_1.scala:14: error: macro implementation has incompatible shape: | ||
required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any] | ||
required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Unit] | ||
or : (x: Impls.this.c.Tree): Impls.this.c.Tree | ||
found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree | ||
type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block | ||
def m3(x: Int) = macro Impls.impl3 | ||
^ | ||
def m3(x: Int): Unit = macro Impls.impl3 | ||
^ | ||
one error found |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import scala.reflect.macros.{BlackboxContext => Ctx} | ||
|
||
trait Impls { | ||
def impl(c: Ctx)(x: c.Expr[Any]) = x | ||
def impl(c: Ctx)(x: c.Expr[Any]) = x | ||
} | ||
|
Oops, something went wrong.