aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-16 17:58:38 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-16 17:58:38 +0200
commitc091b80ba931e9f054963edf826f51341ca04036 (patch)
treec69490509b234f67bdc62572bbf43becb8425da5 /test
parentdba4f1ec3dc5f489056284aab63c771cdd32561c (diff)
downloaddotty-c091b80ba931e9f054963edf826f51341ca04036.tar.gz
dotty-c091b80ba931e9f054963edf826f51341ca04036.tar.bz2
dotty-c091b80ba931e9f054963edf826f51341ca04036.zip
expolaratory worksheet
Diffstat (limited to 'test')
-rw-r--r--test/x/xplore.sc29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/x/xplore.sc b/test/x/xplore.sc
new file mode 100644
index 000000000..04060a7bd
--- /dev/null
+++ b/test/x/xplore.sc
@@ -0,0 +1,29 @@
+package x
+import dotty.tools.dotc._
+import core._
+import Contexts._
+import Symbols._
+import Decorators._
+
+object xplore {
+ println("Welcome to the Scala worksheet") //> Welcome to the Scala worksheet
+ val c = Main.newCompiler //> c : dotty.tools.dotc.Compiler = dotty.tools.dotc.Compiler@5705b99f
+ val base = new ContextBase //> base : dotty.tools.dotc.core.Contexts.ContextBase = dotty.tools.dotc.core.C
+ //| ontexts$ContextBase@30419d05
+ implicit val ctx = c.rootContext(base.initialCtx)
+ //> ctx : dotty.tools.dotc.core.Contexts.Context = dotty.tools.dotc.core.Contex
+ //| ts$InitialContext@1a9d267d
+ val strClass = defn.StringClass //> strClass : dotty.tools.dotc.core.Symbols.ClassSymbol = class String#205
+ strClass.baseClasses //> res0: List[dotty.tools.dotc.core.Symbols.ClassSymbol] = List(class String#20
+ //| 5, class CharSequence#523, class Comparable#94, class Serializable#4192, cla
+ //| ss Object#121, class Any#2416)
+ strClass.typeConstructor <:< defn.AnyType //> res1: Boolean = true
+ val predef = defn.PredefModule //> predef : dotty.tools.dotc.core.Symbols.TermSymbol = module Predef#1627
+ val strd = predef.info.member("String".toTypeName)
+ //> strd : dotty.tools.dotc.core.Denotations.Denotation = type String
+ strd.info //> res2: dotty.tools.dotc.core.Types.Type = TypeAlias(TypeRef(ThisType(module c
+ //| lass lang#49),String))
+ val strType = strd.symbol.typeConstructor //> strType : dotty.tools.dotc.core.Types.TypeRef = TypeRef(ThisType(module cla
+ //| ss Predef$#1628),String)
+ strType <:< defn.AnyType //> res3: Boolean = true
+} \ No newline at end of file