-
Notifications
You must be signed in to change notification settings - Fork 648
[Scala3] Move OpaqueTypeSpec and DirectionSpec #5399
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,7 @@ object OpaqueTypeSpec { | |
| } | ||
|
|
||
| // Illustrate how to dyanmically decide between OpaqueType or not | ||
| sealed trait MaybeBoxed[T <: Data] extends Record { | ||
| sealed abstract class MaybeBoxed[T <: Data] extends Record { | ||
| def underlying: T | ||
| def boxed: Boolean | ||
| } | ||
|
|
@@ -115,12 +115,12 @@ object OpaqueTypeSpec { | |
| class Boxed[T <: Data](gen: T) extends MaybeBoxed[T] { | ||
| def boxed = true | ||
| lazy val elements = SeqMap("underlying" -> gen) | ||
| def underlying = elements.head._2 | ||
| def underlying = elements.head._2.asInstanceOf[T] | ||
| } | ||
|
Comment on lines
117
to
119
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this code doesn't matter that much, users often look at the tests for examples and this is not the right way to fix this. What is happening, is that in Scala 2.13, the type of Better yet than that though would be to change this to just: val underlying = gen
lazy val elements = SeqMap("underlying" -> underlying) |
||
| class Unboxed[T <: Data](gen: T) extends MaybeBoxed[T] with OpaqueType { | ||
| def boxed = false | ||
| lazy val elements = SeqMap("" -> gen) | ||
| def underlying = elements.head._2 | ||
| def underlying = elements.head._2.asInstanceOf[T] | ||
| } | ||
|
|
||
| class MaybeNoAsUInt(noAsUInt: Boolean) extends Record with OpaqueType { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.