File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ Now you can use `nameOf` to get the name of a variable or class member:
2929 nameOf(person.name) -> person.name,
3030 nameOf(person.age) -> person.age
3131 )
32-
32+ ```
33+ ``` mdoc:nest
3334 // compiles to:
3435
3536 def toMap(person: Person) = Map(
@@ -45,7 +46,8 @@ To get the name of a function:
4546 def startCalculation (value : Int ): Unit = {
4647 println(s " Entered ${nameOf(startCalculation _)}" )
4748 }
48-
49+ ```
50+ ``` mdoc:nest
4951 // compiles to:
5052
5153 def startCalculation(value: Int): Unit = {
@@ -62,14 +64,12 @@ Without having an instance of the type:
6264 }
6365
6466 println(nameOf[Person ](_.age))
65-
66- // compiles to:
67-
68- println(" age" )
69-
7067 println(nameOf[Person ](_.sayHello(??? )))
68+ ```
69+ ``` mdoc:nest
70+ // compiles to:
7171
72- // compiles to:
72+ println("age")
7373 println("sayHello")
7474```
7575
@@ -78,7 +78,8 @@ You can also use `nameOfType` to get the unqualified name of a type:
7878 import com .github .dwickern .macros .NameOf ._
7979
8080 println(nameOfType[java.lang.String ])
81-
81+ ```
82+ ``` mdoc:nest
8283 // compiles to:
8384
8485 println("String")
@@ -89,7 +90,8 @@ And `qualifiedNameOfType` to get the qualified name:
8990 import com .github .dwickern .macros .NameOf ._
9091
9192 println(qualifiedNameOfType[java.lang.String ])
92-
93+ ```
94+ ``` mdoc:nest
9395 // compiles to:
9496
9597 println("java.lang.String")
You can’t perform that action at this time.
0 commit comments