Comments (6)
I wonder if typeChecks does not cover the compiler phase that perform the check for the given expected error above
Sorry for the late response. I checked the compiler code implementation of typeChecks
, it does run PostTyper phase, which checks the type bounds.
I'd suggest create a minimized test without ScalaTest by using scala.compiletime.testing.typeChecks
directly. If the error persists, then report a bug to the Scala 3 compiler.
from scalatest.
Filed: scala/scala3#18150
from scalatest.
@dhinojosa Hmm, fyi ScalaTest macro for Scala 3 just use scala.compiletime.testing.typeChecks to check that the given code does not compile, I wonder if typeChecks does not cover the compiler phase that perform the check for the given expected error above. @liufengyun Do you have any idea if that is the case?
from scalatest.
@dhinojosa @liufengyun This is an example without scalatest:
package com.example
object Test:
def main(args: Array[String]): Unit =
val result =
scala.compiletime.testing.typeChecks(
"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(false, "Should fail type check, but it didn't.")
@dhinojosa Would you like to report it to dotty issues?
from scalatest.
@cheeseng That last line will always fail since it is false
, assert(false, "Should fail type check, but it didn't.")
. When I replaced it with assert(result, "Should fail type check, but it didn't.")
it works fine. Let me know if you want to do a follow up test.
from scalatest.
Oh, wait, even if I place the result, this should actually fail
. Sorry, brain fail on my part.
from scalatest.
Related Issues (20)
- Opaque Types don't verify correctly (Maybe ?) HOT 6
- WordSpecLike HOT 3
- Passing position explicitly to test in Scala 3 HOT 5
- Need support for com.vladsch.flexmark:[email protected] HOT 3
- Retry test with delay HOT 5
- assertDoesNotCompile not works when creating mixins HOT 4
- StackDepthException.failedCodeStackDepth returns invalid value `0` when using Future + passing custom implicit position HOT 4
- Passing assert message by-name? HOT 3
- Unexpected compilation warnings: Auto-application to `()` is deprecated. HOT 5
- PrivateMethodTester does not correctly honor type bounds for method arguments HOT 1
- only method not working in Scala 3 Matchers (as List) HOT 1
- InsertionOrderSet performance issue HOT 5
- what's the right way to use scalatest with scalatestplus.junit5? HOT 2
- add back Mockito 4 support? HOT 3
- Shell.run doesn't fail, it would be nice if it could HOT 2
- Execute tasks on SerialExecutionContext outside of a test HOT 2
- Publish artifacts for Scala-Native 0.5.0? HOT 4
- === method causes conflict in Scala 3
- ScalaTest all release jar files are empty and file size is 1kb HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalatest.