New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More dotty support #2147
More dotty support #2147
Conversation
|
||
import DesignTest._ | ||
import wvlet.airspec.AirSpec | ||
|
||
class CustomClassLoader(in: InputStream) extends ObjectInputStream(in) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note) This custom class loader fixes java.lang.ClassCastException: cannot assign instance of scala.collection.generic.DefaultSerializationProxy to field wvlet.airframe.Design.binding of type scala.collection.immutable.Vector in instance of wvlet.airframe.Design
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Serializing Design objects is necessary in td-spark for sending a design to remote Spark worker nodes https://www.slideshare.net/taroleo/tdspark-internals-extending-spark-with-airframe-spark-meetup-tokyo-3-2020
Codecov Report
@@ Coverage Diff @@
## master #2147 +/- ##
=======================================
Coverage 82.62% 82.62%
=======================================
Files 313 313
Lines 12357 12357
Branches 780 780
=======================================
Hits 10210 10210
Misses 2147 2147 Continue to review full report at Codecov.
|
be5352c
to
2df02bd
Compare
@exoego Let me know when this PR is ready for review :) |
@@ -84,7 +84,7 @@ object DesignTest extends AirSpec { | |||
|
|||
test("bind providers") { | |||
val d = newSilentDesign | |||
.bind[Hello].toProvider { (m: ProductionString) => Hello(m) } | |||
.bind[Hello].toProvider[ProductionString] { m => Hello(m) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there should be a workaround for this 😓
If we need to list all types D1, D2, ..., D5 everytime, it would be hard to use provider bindings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, added TODO here
Dotty infer "String" rather than "ProductionString" despite of (m: ProductionString)
val tastyType = quotes.reflect.TypeRepr.typeConstructorOf(paramType) | ||
surfaceOf(tastyType) | ||
}.toSeq | ||
// FIXME: Use TastyInspector as runtime-like reflection for Scala 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try Tasty Inspector for here in subsequent PR. https://dotty.epfl.ch/docs/reference/metaprogramming/tasty-inspect.html
It will be relatively big.
This stalls for a bit, since I think Tasty Inspector as runtime-like reflection is needed to construct |
case Some(expr) => | ||
expr | ||
case None => | ||
// FIXME: Is this right ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. Thanks. There is no major concern for now.
Summary
Raw results
Before
After