This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
620ff4a
commit af2d6ad
Showing
2 changed files
with
32 additions
and
0 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
31 changes: 31 additions & 0 deletions
31
test-suite/src/main/scala/testsuite/core/InterfaceCall.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,31 @@ | ||
package testsuite.core.interfacecall | ||
|
||
import scala.scalajs.js.annotation._ | ||
|
||
object InterfaceCall { | ||
def main(): Unit = { val _ = test() } | ||
|
||
@JSExportTopLevel("interfaceCall") | ||
def test(): Boolean = { | ||
val c = new Concrete() | ||
c.plus(c.zero, 1) == 1 && c.minus(1, c.zero) == 1 | ||
} | ||
|
||
class Concrete extends AddSub with Zero { | ||
override def zero: Int = 0 | ||
} | ||
|
||
trait Adder { | ||
def plus(a: Int, b: Int) = a + b | ||
} | ||
|
||
trait Sub { | ||
def minus(a: Int, b: Int): Int = a - b | ||
} | ||
|
||
trait AddSub extends Adder with Sub | ||
|
||
trait Zero { | ||
def zero: Int | ||
} | ||
} |