diff options
author | Martin Odersky <odersky@gmail.com> | 2015-07-01 15:59:33 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-07-06 17:46:45 +0200 |
commit | 84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c (patch) | |
tree | 309525b19d9f063a384d4e2561f0b29a34986c43 /src/dotty/tools/dotc/core/Types.scala | |
parent | 64f65182f6e4f80b03d45923e02441dafe0755b4 (diff) | |
download | dotty-84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c.tar.gz dotty-84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c.tar.bz2 dotty-84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c.zip |
Add @sharable annotation
Add @sharable annotation for classes and vals that are presumed
to be safely sharable between threads.
Also: Document CtxLazy.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index d6bb9c3c5..85e2634d4 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1,4 +1,5 @@ -package dotty.tools.dotc +package dotty.tools +package dotc package core import util.common._ @@ -35,7 +36,7 @@ import language.implicitConversions object Types { - private var nextId = 0 + @sharable private var nextId = 0 /** The class of types. * The principal subclasses and sub-objects are as follows: @@ -73,6 +74,7 @@ object Types { // ----- Tests ----------------------------------------------------- + // debug only: a unique identifier for a type val uniqId = { nextId = nextId + 1 // if (nextId == 19555) @@ -2752,13 +2754,13 @@ object Types { case class ImportType(expr: Tree) extends UncachedGroundType /** Sentinel for "missing type" */ - case object NoType extends CachedGroundType { + @sharable case object NoType extends CachedGroundType { override def exists = false override def computeHash = hashSeed } /** Missing prefix */ - case object NoPrefix extends CachedGroundType { + @sharable case object NoPrefix extends CachedGroundType { override def computeHash = hashSeed } @@ -2775,7 +2777,7 @@ object Types { final class CachedWildcardType(optBounds: Type) extends WildcardType(optBounds) - object WildcardType extends WildcardType(NoType) { + @sharable object WildcardType extends WildcardType(NoType) { def apply(bounds: TypeBounds)(implicit ctx: Context) = unique(new CachedWildcardType(bounds)) } @@ -2983,7 +2985,7 @@ object Types { } } - object IdentityTypeMap extends TypeMap()(NoContext) { + @sharable object IdentityTypeMap extends TypeMap()(NoContext) { override def stopAtStatic = true def apply(tp: Type) = tp } @@ -3208,7 +3210,7 @@ object Types { // ----- Debug --------------------------------------------------------- - var debugTrace = false + @sharable var debugTrace = false val watchList = List[String]( ) map (_.toTypeName) |