diff options
author | allisonhb <allisonhb@gmx.com> | 2016-12-07 21:45:30 -0500 |
---|---|---|
committer | allisonhb <allisonhb@gmx.com> | 2016-12-14 14:13:01 -0500 |
commit | fab1db5a3854ae737e1d749eb08be9baf41199f5 (patch) | |
tree | 9db8b4320157afbac06bfb3a832f3682e64bf625 /src/library/scala | |
parent | 8badcadbe51f4a02e495f462f5f2666a24d79cb0 (diff) | |
download | scala-fab1db5a3854ae737e1d749eb08be9baf41199f5.tar.gz scala-fab1db5a3854ae737e1d749eb08be9baf41199f5.tar.bz2 scala-fab1db5a3854ae737e1d749eb08be9baf41199f5.zip |
SI-4700 Make infix notation default for symbolic types.
Add ability to disable this via the @showAsInfix annotation.
Diffstat (limited to 'src/library/scala')
-rw-r--r-- | src/library/scala/annotation/showAsInfix.scala | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/library/scala/annotation/showAsInfix.scala b/src/library/scala/annotation/showAsInfix.scala index 41c93b697f..6c25e08efa 100644 --- a/src/library/scala/annotation/showAsInfix.scala +++ b/src/library/scala/annotation/showAsInfix.scala @@ -1,21 +1,27 @@ package scala.annotation /** - * This annotation, used for two-parameter generic types makes Scala print - * the type using infix notation: - * - * ``` - * scala> class &&[T, U] - * defined class $amp$amp - * - * scala> def foo: Int && Int = ??? - * foo: &&[Int,Int] - * - * scala> @showAsInfix class &&[T, U] - * defined class $amp$amp - * - * scala> def foo: Int && Int = ??? - * foo: Int && Int - * ``` - */ -class showAsInfix extends annotation.StaticAnnotation
\ No newline at end of file + * This annotation configures how Scala prints two-parameter generic types. + * + * By default, types with symbolic names are printed infix; while types without + * them are printed using the regular generic type syntax. + * + * Example of usage: + {{{ + scala> class Map[T, U] + defined class Map + + scala> def foo: Int Map Int = ??? + foo: Map[Int,Int] + + scala> @showAsInfix class Map[T, U] + defined class Map + + scala> def foo: Int Map Int = ??? + foo: Int Map Int + }}} + * + * @param enabled whether to show this type as an infix type operator. + * @since 2.12.2 + */ +class showAsInfix(enabled: Boolean = true) extends annotation.StaticAnnotation
\ No newline at end of file |