-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend compiletime.testing.typechecks with certain transform phases
- Loading branch information
Showing
6 changed files
with
117 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,5 @@ named-tuples-strawman-2.scala | |
|
||
# typecheckErrors method unpickling | ||
typeCheckErrors.scala | ||
i18150.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,2 @@ | ||
List(Error(illegal inheritance: self type Banana of class Banana does not conform to self type Apple | ||
of parent trait RecursiveSelfTypeEntity,class Banana extends RecursiveSelfTypeEntity[Apple]:,6,Typer)) |
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 @@ | ||
object Test: | ||
def main(args: Array[String]): Unit = | ||
val result = | ||
scala.compiletime.testing.typeCheckErrors( | ||
"trait RecursiveSelfTypeEntity[E <: RecursiveSelfTypeEntity[E]]: \n" + | ||
" self: E => \n" + | ||
" def create(): E \n" + | ||
" def read(id: Long): Option[E] \n" + | ||
" def update(f: E => E): E \n" + | ||
" def delete(id: Long): Unit \n" + | ||
"\n" + | ||
"class Apple extends RecursiveSelfTypeEntity[Apple]: \n" + | ||
" override def create(): Apple = ??? \n" + | ||
" override def read(id: Long): Option[Apple] = ??? \n" + | ||
" override def update(f: Apple => Apple): Apple = ??? \n" + | ||
" override def delete(id: Long): Unit = ??? \n" + | ||
" \n" + | ||
"class Orange extends RecursiveSelfTypeEntity[Orange]: \n" + | ||
" override def create(): Orange = ??? \n" + | ||
" override def read(id: Long): Option[Orange] = ??? \n" + | ||
" override def update(f: Orange => Orange): Orange = ??? \n" + | ||
" override def delete(id: Long): Unit = ??? \n" + | ||
" \n" + | ||
"class Banana extends RecursiveSelfTypeEntity[Apple]: \n" + | ||
" override def create(): Apple = ??? \n" + | ||
" override def read(id: Long): Option[Apple] = ??? \n" + | ||
" override def update(f: Apple => Apple): Apple = ??? \n" + | ||
" override def delete(id: Long): Unit = ???\n" | ||
) | ||
assert(!result.isEmpty, "Should fail type check, but it didn't.") | ||
println(result) |