From 96a817da9ac2cac73c4994cbc8cd9048e6f2227d Mon Sep 17 00:00:00 2001 From: michelou Date: Wed, 9 May 2007 13:41:01 +0000 Subject: added tests for contribs #460 and #461 --- src/compiler/scala/tools/nsc/doc/ModelFrames.scala | 12 ++++++------ test/files/run/patseq.check | 1 + test/files/run/patseq.scala | 11 +++++++++++ test/files/run/patunreachable.check | 1 + test/files/run/patunreachable.scala | 9 +++++++++ 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 test/files/run/patseq.check create mode 100644 test/files/run/patseq.scala create mode 100644 test/files/run/patunreachable.check create mode 100644 test/files/run/patunreachable.scala diff --git a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala index d7ce08d85f..3d448c83f3 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala @@ -104,6 +104,8 @@ trait ModelFrames extends ModelExtractor { case msym: ModuleSymbol => urlFor0(sym, sym) + FILE_EXTENSION_HTML case csym: ClassSymbol => + if (csym.name == "$colon$colon") + Console.println("****************************" + csym.name) urlFor0(sym, sym) + FILE_EXTENSION_HTML case _ => val cnt = urlFor(decode(sym.owner)) @@ -136,12 +138,11 @@ trait ModelFrames extends ModelExtractor { }), encoding) } - - def urlFor0(sym: Symbol, orig: Symbol): String = { + def urlFor0(sym: Symbol, orig: Symbol): String = (if (sym == NoSymbol) "XXX" - else if (sym.owner.isPackageClass) { - rootFor(sym) + pkgPath(sym); - } else urlFor0(decode(sym.owner), orig) + "." + Utility.escape(sym.nameString)) + + else if (sym.owner.isPackageClass) rootFor(sym) + pkgPath(sym) + else urlFor0(decode(sym.owner), orig) + "." + Utility.escape(sym.nameString) + ) + (sym match { case msym: ModuleSymbol => if (msym hasFlag Flags.PACKAGE) NAME_SUFFIX_PACKAGE @@ -152,7 +153,6 @@ trait ModelFrames extends ModelExtractor { case _ => "" }) - } } def pkgPath(sym : global.Symbol) = sym.fullNameString('/') match { case "" => "_empty_" diff --git a/test/files/run/patseq.check b/test/files/run/patseq.check new file mode 100644 index 0000000000..bc56c4d894 --- /dev/null +++ b/test/files/run/patseq.check @@ -0,0 +1 @@ +Foo diff --git a/test/files/run/patseq.scala b/test/files/run/patseq.scala new file mode 100644 index 0000000000..7fe8072b5f --- /dev/null +++ b/test/files/run/patseq.scala @@ -0,0 +1,11 @@ +// contribution bug #461 + +object Test extends Application { + def foo(ps: String*) = "Foo" + case class X(p: String, ps: String*) + def bar = + X("a", "b") match { + case X(p, ps @ _*) => foo(ps : _*) + } + println(bar) +} diff --git a/test/files/run/patunreachable.check b/test/files/run/patunreachable.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/patunreachable.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/patunreachable.scala b/test/files/run/patunreachable.scala new file mode 100644 index 0000000000..4cc6181e81 --- /dev/null +++ b/test/files/run/patunreachable.scala @@ -0,0 +1,9 @@ +// contribution bug #460 + +object Test extends Application { + val x = Some(3) match { + case Some(1 | 2) => 1 + case Some(3) => 2 + } + println(x) +} -- cgit v1.2.3