-
Notifications
You must be signed in to change notification settings - Fork 70
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 #778 from jeroentervoorde/private-constructors
Ignore private constructors
- Loading branch information
Showing
29 changed files
with
200 additions
and
37 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
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
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
5 changes: 5 additions & 0 deletions
5
functional-tests/src/test/case-class-private-constructor-changes-ok/app/App.scala
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,5 @@ | ||
object App { | ||
def main(args: Array[String]): Unit = { | ||
println(foo.Foo()) | ||
} | ||
} |
Empty file.
2 changes: 2 additions & 0 deletions
2
functional-tests/src/test/case-class-private-constructor-changes-ok/scalac-options-2.13.txt
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,2 @@ | ||
-Xsource:3 | ||
-Wconf:cat=scala3-migration:s |
1 change: 1 addition & 0 deletions
1
functional-tests/src/test/case-class-private-constructor-changes-ok/skip-2.11.txt
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 @@ | ||
Code does not compile on 2.11 because unapply cannot be redefined |
1 change: 1 addition & 0 deletions
1
functional-tests/src/test/case-class-private-constructor-changes-ok/skip-2.12.txt
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 @@ | ||
Code does not compile on 2.11 because unapply cannot be redefined |
9 changes: 9 additions & 0 deletions
9
functional-tests/src/test/case-class-private-constructor-changes-ok/v1/A.scala
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,9 @@ | ||
package foo | ||
|
||
case class Foo private (a: String) | ||
|
||
object Foo { | ||
def apply() = new Foo("a") | ||
|
||
private def unapply(f: Foo) = f | ||
} |
9 changes: 9 additions & 0 deletions
9
functional-tests/src/test/case-class-private-constructor-changes-ok/v2/A.scala
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,9 @@ | ||
package foo | ||
|
||
case class Foo private (a: String, b: String) {} | ||
object Foo { | ||
def apply() = new Foo("a", "b") | ||
def apply(a: String) = new Foo(a, "b") | ||
|
||
private def unapply(f: Foo) = f | ||
} |
5 changes: 5 additions & 0 deletions
5
functional-tests/src/test/class-private-constructor-changes-ok/app/App.scala
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,5 @@ | ||
object App { | ||
def main(args: Array[String]): Unit = { | ||
println(foo.Foo()) | ||
} | ||
} |
Empty file.
7 changes: 7 additions & 0 deletions
7
functional-tests/src/test/class-private-constructor-changes-ok/v1/A.scala
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,7 @@ | ||
package foo | ||
|
||
class Foo private (val a: String) | ||
|
||
object Foo { | ||
def apply() = new Foo("a") | ||
} |
7 changes: 7 additions & 0 deletions
7
functional-tests/src/test/class-private-constructor-changes-ok/v2/A.scala
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,7 @@ | ||
package foo | ||
|
||
class Foo private (val a: String, val b: String) {} | ||
object Foo { | ||
def apply() = new Foo("a", "b") | ||
def apply(a: String) = new Foo(a, "b") | ||
} |
5 changes: 5 additions & 0 deletions
5
functional-tests/src/test/package-nested-private-constructor-changes-ok/app/App.scala
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,5 @@ | ||
object App { | ||
def main(args: Array[String]): Unit = { | ||
println(foo.Foo.Bar()) | ||
} | ||
} |
Empty file.
9 changes: 9 additions & 0 deletions
9
functional-tests/src/test/package-nested-private-constructor-changes-ok/v1/A.scala
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,9 @@ | ||
package foo | ||
|
||
object Foo { | ||
class Bar private[foo](a: String) {} | ||
|
||
object Bar { | ||
def apply() = new Bar("a") | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
functional-tests/src/test/package-nested-private-constructor-changes-ok/v2/A.scala
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,10 @@ | ||
package foo | ||
|
||
object Foo { | ||
class Bar private[foo](a: Int, val b: String) {} | ||
|
||
object Bar { | ||
def apply() = new Bar(123, "b") | ||
def apply(a: String) = new Bar(a.toInt, "b") | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
functional-tests/src/test/package-private-constructor-changes-ok/app/App.scala
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,5 @@ | ||
object App { | ||
def main(args: Array[String]): Unit = { | ||
println(foo.Foo()) | ||
} | ||
} |
Empty file.
7 changes: 7 additions & 0 deletions
7
functional-tests/src/test/package-private-constructor-changes-ok/v1/A.scala
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,7 @@ | ||
package foo | ||
|
||
class Foo private[foo](a: String) {} | ||
|
||
object Foo { | ||
def apply() = new Foo("a") | ||
} |
Oops, something went wrong.