diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-19 15:01:46 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-20 15:25:53 -0700 |
commit | c29405dfe1a24419ce4ce10500b5e8d05c581bee (patch) | |
tree | dca5ea3a915101613b6d007831d9240596b685f5 /test/files/run/analyzerPlugins.check | |
parent | d506bedc5ab83bf9af8cc0240e61a0c691f8508b (diff) | |
download | scala-c29405dfe1a24419ce4ce10500b5e8d05c581bee.tar.gz scala-c29405dfe1a24419ce4ce10500b5e8d05c581bee.tar.bz2 scala-c29405dfe1a24419ce4ce10500b5e8d05c581bee.zip |
Simplify type bounds.
I started out looking to limit the noise from empty type
bounds, i.e. the endless repetition of
class A[T >: _root_.scala.Nothing <: _root_.scala.Any]
This led me to be reminded of all the unnecessary and
in fact damaging overreaches which are performed during parsing.
Why should a type parameter for which no bounds are
specified be immediately encoded with this giant tree:
TypeBounds(
Select(Select(Ident(nme.ROOTPKG), tpnme.scala_), tpnme.Nothing),
Select(Select(Ident(nme.ROOTPKG), tpnme.scala_), tpnme.Any)
)
...which must then be manually recognized as empty type bounds?
Truly, this is madness.
- It deftly eliminates the possibility of recognizing
whether the user wrote "class A[T]" or "class A[T >: Nothing]"
or "class A[T <: Any]" or specified both bounds. The fact
that these work out the same internally does not imply the
information should be exterminated even before parsing completes.
- It burdens everyone who must recognize type bounds trees,
such as this author
- It is far less efficient than the obvious encoding
- It offers literally no advantage whatsoever
Encode empty type bounds as
TypeBounds(EmptyTree, EmptyTree)
What could be simpler.
Diffstat (limited to 'test/files/run/analyzerPlugins.check')
-rw-r--r-- | test/files/run/analyzerPlugins.check | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/test/files/run/analyzerPlugins.check b/test/files/run/analyzerPlugins.check index 297bd36bae..641fbfff6b 100644 --- a/test/files/run/analyzerPlugins.check +++ b/test/files/run/analyzerPlugins.check @@ -25,13 +25,13 @@ pluginsPt(?, Trees$Assign) [7] pluginsPt(?, Trees$Block) [4] pluginsPt(?, Trees$ClassDef) [2] pluginsPt(?, Trees$DefDef) [14] -pluginsPt(?, Trees$Ident) [51] +pluginsPt(?, Trees$Ident) [50] pluginsPt(?, Trees$If) [2] pluginsPt(?, Trees$Literal) [16] pluginsPt(?, Trees$New) [5] pluginsPt(?, Trees$PackageDef) [1] pluginsPt(?, Trees$Return) [1] -pluginsPt(?, Trees$Select) [52] +pluginsPt(?, Trees$Select) [48] pluginsPt(?, Trees$Super) [2] pluginsPt(?, Trees$This) [20] pluginsPt(?, Trees$TypeApply) [4] @@ -112,7 +112,6 @@ pluginsTyped(<notype>, Trees$DefDef) [14] pluginsTyped(<notype>, Trees$PackageDef) [1] pluginsTyped(<notype>, Trees$TypeDef) [1] pluginsTyped(<notype>, Trees$ValDef) [21] -pluginsTyped(<root>, Trees$Ident) [1] pluginsTyped(=> Boolean @testAnn, Trees$Select) [1] pluginsTyped(=> Double, Trees$Select) [4] pluginsTyped(=> Int, Trees$Select) [5] @@ -151,7 +150,6 @@ pluginsTyped(List[Any], Trees$Apply) [1] pluginsTyped(List[Any], Trees$Select) [1] pluginsTyped(List[Any], Trees$TypeTree) [3] pluginsTyped(Nothing, Trees$Return) [1] -pluginsTyped(Nothing, Trees$Select) [2] pluginsTyped(Object, Trees$Apply) [1] pluginsTyped(String @testAnn, Trees$Ident) [1] pluginsTyped(String @testAnn, Trees$Select) [1] @@ -185,8 +183,6 @@ pluginsTyped(scala.annotation.TypeConstraint, Trees$TypeTree) [2] pluginsTyped(scala.collection.immutable.List.type, Trees$Select) [2] pluginsTyped(scala.collection.immutable.StringOps, Trees$ApplyImplicitView) [2] pluginsTyped(scala.collection.mutable.WrappedArray[Any], Trees$Apply) [1] -pluginsTyped(scala.type, Trees$Ident) [1] -pluginsTyped(scala.type, Trees$Select) [1] pluginsTyped(str.type, Trees$Ident) [3] pluginsTyped(testAnn, Trees$Apply) [5] pluginsTyped(testAnn, Trees$Ident) [5] |