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.
Deprecate package objects with inheritance
This deprecates package objects with inheritance, and removes it under -Xsource:2.14. Ref scala/scala-dev#488 Ref scala/scala-dev#441
- Loading branch information
Showing
15 changed files
with
99 additions
and
18 deletions.
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,6 @@ | ||
package-inheritance-deprecation.scala:39: warning: package objects with parent classes or traits are deprecated | ||
package object bar extends Duh with Duh2 { } | ||
^ | ||
error: No warnings can be incurred under -Xfatal-warnings. | ||
one warning found | ||
one error found |
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 @@ | ||
-Xfatal-warnings -deprecation |
File renamed without changes.
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,4 @@ | ||
package-inheritance-removal.scala:39: error: package objects with parent classes or traits are unsupported | ||
package object bar extends Duh with Duh2 { } | ||
^ | ||
one error found |
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 @@ | ||
-Xsource:2.14 |
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,62 @@ | ||
// a.scala | ||
// Fri Jan 13 11:31:47 PST 2012 | ||
|
||
package foo { | ||
package object bar { | ||
def duh(n: Long) = println("long") | ||
def duh(n: Double) = println("double") | ||
|
||
def duh2(n: Double) = println("double") | ||
def duh2(n: Long) = println("long") | ||
} | ||
package bar { | ||
object Main { | ||
def main(args:Array[String]): Unit = { | ||
duh(33L) | ||
bip.bar.duh(33L) | ||
duh(33d) | ||
bip.bar.duh(33d) | ||
|
||
duh2(33L) | ||
bip.bar.duh2(33L) | ||
duh2(33d) | ||
bip.bar.duh2(33d) | ||
} | ||
} | ||
} | ||
} | ||
|
||
package bip { | ||
trait Duh { | ||
def duh(n: Long) = println("long") | ||
def duh(n: Double) = println("double") | ||
} | ||
trait Duh2 { | ||
def duh2(n: Double) = println("double") | ||
def duh2(n: Long) = println("long") | ||
} | ||
|
||
package object bar extends Duh with Duh2 { } | ||
package bar { | ||
object Main { | ||
def main(args:Array[String]): Unit = { | ||
duh(33L) | ||
bip.bar.duh(33L) | ||
duh(33d) | ||
bip.bar.duh(33d) | ||
|
||
duh2(33L) | ||
bip.bar.duh2(33L) | ||
duh2(33d) | ||
bip.bar.duh2(33d) | ||
} | ||
} | ||
} | ||
} | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
foo.bar.Main.main(null) | ||
bip.bar.Main.main(null) | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
-Xfatal-warnings -Xdev | ||
-deprecation -Xdev |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
pkg2.scala:3: warning: package objects with parent classes or traits are deprecated | ||
package object xml extends PullIteratees | ||
^ | ||
ok! |
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 @@ | ||
-deprecation |
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 @@ | ||
-deprecation |
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