-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2592006
commit d865ac1
Showing
11 changed files
with
762 additions
and
6 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
frontends/benchmarks/dotty-specific/invalid/ExportedMethods1.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,20 @@ | ||
object ExportedMethods1 { | ||
case class Counter(var x: BigInt) { | ||
def add(y: BigInt): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
} | ||
|
||
case class Base(cnt: Counter) { | ||
export cnt.* | ||
} | ||
|
||
case class Wrapper(base: Base) { | ||
export base.* | ||
|
||
def addWith(y: BigInt): Unit = { | ||
add(y) // invalid | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
frontends/benchmarks/dotty-specific/invalid/ExportedMethods2.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,11 @@ | ||
object ExportedMethods2 { | ||
import ExportedMethodsExt.SimpleCounter.* | ||
|
||
case class Wrapper(base: Base) { | ||
export base.* | ||
|
||
def addWith(y: BigInt): Unit = { | ||
add(y) // invalid | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
frontends/benchmarks/dotty-specific/invalid/ExportedMethods3.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,11 @@ | ||
object ExportedMethods3 { | ||
import ExportedMethodsExt.CounterWithInvariant.* | ||
|
||
case class Wrapper(base: Base) { | ||
export base.* | ||
|
||
def addWith(y: BigInt): Unit = { | ||
x = y | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
frontends/benchmarks/dotty-specific/invalid/ExportedMethodsExt.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,87 @@ | ||
object ExportedMethodsExt { | ||
|
||
// This object is used for the other ExportedMethods | ||
// but we need to have at least one invalid VC to pass the "invalid" test suite | ||
def dummyInvalid(x: BigInt): Unit = { | ||
assert(x == 0) | ||
} | ||
|
||
object SimpleCounter { | ||
case class Counter(var x: BigInt) { | ||
def add(y: BigInt): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
|
||
def parametricAdd[T](y: BigInt, t: T): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
} | ||
|
||
case class Base(cnt: Counter) { | ||
export cnt.* | ||
} | ||
} | ||
|
||
object CounterWithInvariant { | ||
case class Counter(var x: BigInt) { | ||
require(x >= 0) | ||
|
||
def add(y: BigInt): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
|
||
def parametricAdd[T](y: BigInt, t: T): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
} | ||
|
||
case class Base(cnt: Counter) { | ||
export cnt.* | ||
} | ||
} | ||
|
||
object AbstractCounter { | ||
abstract case class Counter() { | ||
var x: BigInt | ||
|
||
def add(y: BigInt): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
|
||
def parametricAdd[T](y: BigInt, t: T): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
} | ||
|
||
case class Base(cnt: Counter) { | ||
export cnt.* | ||
} | ||
} | ||
|
||
object AbstractBaseAndCounter { | ||
abstract case class Counter() { | ||
var x: BigInt | ||
|
||
def add(y: BigInt): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
|
||
def parametricAdd[T](y: BigInt, t: T): Unit = { | ||
require(y >= 0) | ||
x += y | ||
} | ||
} | ||
|
||
abstract case class Base() { | ||
val cnt: Counter | ||
export cnt.* | ||
} | ||
} | ||
} |
Oops, something went wrong.