Skip to content

Conversation

@nogurenn
Copy link
Contributor

Other parts of this have the updated ___Name() syntax. These examples were probably just missed.

Other parts of this have the updated `___Name()` syntax. These examples were probably just missed.
@nogurenn nogurenn changed the title Fix outdated sample code for querying types Fix outdated sample code for querying types in Symbols doc Jun 11, 2020
@nogurenn
Copy link
Contributor Author

I missed this part. What return type do I use? I'll add it to this PR.

@ import scala.language.experimental.macros 
import scala.language.experimental.macros

@ def impl(c: scala.reflect.macros.Context) = c.Expr[Unit](c.parse("println(2)")) 
defined function impl

@ def test = macro impl 
cmd102.sc:1: macro defs must have explicitly specified return types
def test = macro impl
    ^
Compilation Failed

@nogurenn nogurenn requested a review from SethTisue June 12, 2020 01:13
@SethTisue
Copy link
Member

SethTisue commented Jun 12, 2020

Unit:

[...]

scala 2.13.2> def test: Unit = macro impl
def test: Unit

scala 2.13.2> test
2

@nogurenn
Copy link
Contributor Author

I missed that big time. Sorry :(

nogurenn added 4 commits June 12, 2020 11:26
Based on deprecation doc of `stringToTermName` and `stringToTypeName`, people should avoid using these implicit conversions in particular.
`isOverride` is now private according to the 2.13 source. Changing the example to `isFinal` instead.
@SethTisue SethTisue merged commit 260b424 into scala:master Jun 17, 2020
@SethTisue
Copy link
Member

excellent, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants