Repository cloned from Github show multiple warnings when compiling and running "HelloWorld.scala"

47 views
Skip to first unread message

George Zhang

unread,
Mar 29, 2017, 11:34:50 PM3/29/17
to dotty-internals
Hello everyone,

This is my first day in the dotty community. Just read the "Getting Started" and tried to get started.

After
$ git clone https://github.com/lampepfl/dotty.git
$
cd dotty
$ sbt

I was prompted
[WARNING] Missing `dotty/scala-scala` library
You can clone the library with:
  > git clone -b dotty-library https://github.com/DarkDimius/scala.git /Users/GeorgeZhang/dotty/scala-scala

Not a bit problem. For sure. But the "Getting Started" guide forgot to include that.

The real problem is that when I tried to compile the "HelloWorld.scala", a whole bunch of [warn] comes up:
> dotc tests/pos/HelloWorld.scala
[info] Updating {file:/Users/GeorgeZhang/dotty/}dotty-interfaces...
[info] Updating {file:/Users/GeorgeZhang/dotty/}dotty-library...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Resolving jline#jline;2.12 ...
[info] Compiling 23 Scala sources and 136 Java sources to /Users/GeorgeZhang/dotty/library/target/scala-2.11/classes...
[info] Done updating.
[info] Updating {file:/Users/GeorgeZhang/dotty/}dotty-compiler...
[info] Resolving org.scala-lang#scala-library;2.11.5 ...
[info] Compiling 7 Java sources to /Users/GeorgeZhang/dotty/interfaces/target/classes...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Packaging /Users/GeorgeZhang/dotty/interfaces/target/dotty-interfaces-0.1.1-SNAPSHOT.jar ...
[info] Done packaging.
[info] Packaging /Users/GeorgeZhang/dotty/library/target/scala-2.11/dotty-library_2.11-0.1.1-SNAPSHOT.jar ...
[info] Compiling 272 Scala sources and 1 Java source to /Users/GeorgeZhang/dotty/compiler/target/scala-2.11/classes...
[info] Done packaging.
[warn] /Users/GeorgeZhang/dotty/compiler/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala:162: non-variable type argument dotty.tools.dotc.core.tasty.TastyBuffer.Addr in type pattern List[dotty.tools.dotc.core.tasty.TastyBuffer.Addr] (the underlying of List[dotty.tools.dotc.core.tasty.TastyBuffer.Addr]) is unchecked since it is eliminated by erasure
[warn]         case addrs: List[Addr] => treeAddrs.put(tree, addrs.map(adjusted))
[warn]                     ^
[warn] /Users/GeorgeZhang/dotty/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala:163: non-variable type argument dotty.tools.dotc.core.Types.Type in type pattern dotty.tools.dotc.ast.Trees.Tree[dotty.tools.dotc.core.Types.Type] (the underlying of dotty.tools.dotc.ast.tpd.Tree) is unchecked since it is eliminated by erasure
[warn]           case dummyTreeOfType(tp) :: Nil if !(tp isRef defn.NullClass) => "null: " ~ toText(tp)
[warn]                               ^
[warn] /Users/GeorgeZhang/dotty/compiler/src/dotty/tools/dotc/transform/PostTyper.scala:267: non-variable type argument dotty.tools.dotc.core.Types.Type in type pattern dotty.tools.dotc.ast.Trees.Ident[dotty.tools.dotc.core.Types.Type] (the underlying of dotty.tools.dotc.ast.tpd.Ident) is unchecked since it is eliminated by erasure
[warn]             case ident: Ident                 => checkIdent(ident)
[warn]                         ^
[warn] /Users/GeorgeZhang/dotty/compiler/src/dotty/tools/dotc/transform/PostTyper.scala:268: non-variable type argument dotty.tools.dotc.core.Types.Type in type pattern dotty.tools.dotc.ast.Trees.Ident[dotty.tools.dotc.core.Types.Type] (the underlying of dotty.tools.dotc.ast.tpd.Ident) is unchecked since it is eliminated by erasure
[warn]             case Thicket((ident: Ident) :: _) => checkIdent(ident)
[warn]                                  ^
[warn] /Users/GeorgeZhang/dotty/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala:148: non-variable type argument dotty.tools.dotc.core.Types.Type in type pattern dotty.tools.dotc.ast.Trees.DefTree[dotty.tools.dotc.core.Types.Type] (the underlying of dotty.tools.dotc.ast.tpd.DefTree) is unchecked since it is eliminated by erasure
[warn]       case tree: DefTree =>
[warn]                  ^
[warn] there were 7 unchecked warnings; re-run with -unchecked for details
[warn] 6 warnings found
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Compiling 46 Scala sources and 3 Java sources to /Users/GeorgeZhang/dotty/compiler/target/scala-2.11/test-classes...
[info] Packaging /Users/GeorgeZhang/dotty/compiler/target/scala-2.11/dotty-compiler_2.11-0.1.1-SNAPSHOT.jar ...
[info] Done packaging.
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Packaging /Users/GeorgeZhang/dotty/compiler/target/scala-2.11/dotty-compiler_2.11-0.1.1-SNAPSHOT-tests.jar ...
[info] Done packaging.
[info] Running dotty.tools.dotc.Main tests/pos/HelloWorld.scala -classpath /Users/GeorgeZhang/dotty/library/target/scala-2.11/dotty-library_2.11-0.1.1-SNAPSHOT.jar
[success] Total time: 201 s, completed Mar 29, 2017 11:29:19 PM

Then when I run the "HelloWorld.scala" program, some other warnings come up:
> dotr HelloWorld
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Packaging /Users/GeorgeZhang/dotty/compiler/target/scala-2.11/dotty-compiler_2.11-0.1.1-SNAPSHOT.jar ...
[info] Done packaging.
hello world
[success] Total time: 9 s, completed Mar 29, 2017 11:31:10 PM

IMHB, it is really scary when compiling and running a simple "HelloWorld.scala" can result in so many warnings. I have no clue if all these warnings are normal and expected at this development stage or something is wrong with the current repository. Any word of wisdom on this issue?

George

Guillaume Martres

unread,
Mar 30, 2017, 4:33:57 AM3/30/17
to dotty-internals
Hi George,

Yes, there's a bunch of warnings in the build which should all (hopefully) be benign, I'm hoping we'll get to fix them all in the near future and then add -Xfatal-warnings in the build to stop them from creeping on us. Note that these warnings are not warnings emitted by dotty when it compiled your HelloWorld, but warnings emitted by scalac when it compiled dotty itself. Similarly, the warning you got when you used "dotr" is due to a missing configuration option in dotty's sbt build and has nothing to do with the HelloWorld example. By the way, this mailing-list is likely to be closed soon in favor of https://contributors.scala-lang.org/c/dotty

Cheers,
Guillaume
Reply all
Reply to author
Forward
0 new messages