forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#8787 from dwijnand/2.12/repl/class-based/out…
…er-pointers [2.12] Silence outer pointer warnings in class-based REPL
- Loading branch information
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
scala> sealed abstract class Value; object Value { | ||
final case class Num(value: Double) extends Value | ||
final case class Str(value: String) extends Value | ||
final case class Bool(value: Boolean) extends Value | ||
} | ||
defined class Value | ||
defined object Value | ||
|
||
scala> class C { final case class Num(value: Double) } // here it should still warn | ||
warning: there was one unchecked warning; for details, enable `:setting -unchecked' or `:replay -unchecked' | ||
defined class C | ||
|
||
scala> :quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import scala.tools.nsc.Settings | ||
import scala.tools.partest.ReplTest | ||
|
||
object Test extends ReplTest { | ||
override def transformSettings(s: Settings) = { | ||
s.Yreplclassbased.value = true | ||
s | ||
} | ||
|
||
def code = """ | ||
|sealed abstract class Value; object Value { | ||
| final case class Num(value: Double) extends Value | ||
| final case class Str(value: String) extends Value | ||
| final case class Bool(value: Boolean) extends Value | ||
|} | ||
|class C { final case class Num(value: Double) } // here it should still warn | ||
|""".stripMargin // scala/bug#11902 | ||
} | ||
|
||
/* was: | ||
scala> sealed abstract class Value; object Value { | ||
final case class Num(value: Double) extends Value | ||
final case class Str(value: String) extends Value | ||
final case class Bool(value: Boolean) extends Value | ||
} | ||
warning: there were three unchecked warnings; for details, enable `:setting -unchecked' or `:replay -unchecked' | ||
defined class Value | ||
defined object Value | ||
scala> class C { final case class Num(value: Double) } // here it should still warn | ||
warning: there was one unchecked warning; for details, enable `:setting -unchecked' or `:replay -unchecked' | ||
defined class C | ||
*/ |