-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use transparent inline in the library #8756
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
Changes from 3 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 |
---|---|---|
|
@@ -8,7 +8,7 @@ object DottyPredef { | |
assertFail(message) | ||
} | ||
|
||
inline final def assert(inline assertion: Boolean) <: Unit = { | ||
transparent inline final def assert(inline assertion: Boolean): Unit = { | ||
if (!assertion) | ||
assertFail() | ||
} | ||
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. Maybe I miss something here, what is the purpose of making this white box, as the result type is 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. If you write assert(false) the inclined expression becomes of type Nothing. 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. It is like a ??? With a message 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. Not sure if this should be supported thought |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class Foo { | ||
inline def foo <: Int = try { 1 } finally println("Hello") | ||
transparent inline def foo: Int = try { 1 } finally println("Hello") | ||
foo | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
object Test { | ||
class C { type T } | ||
inline def foo[U] <: Any = (??? : C { type T = U }) | ||
transparent inline def foo[U]: Any = (??? : C { type T = U }) | ||
|
||
foo[Int] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
trait A | ||
class B extends A | ||
|
||
inline given tc as _ <: A = B() | ||
transparent inline given tc as A = B() | ||
|
||
val x: B = summon[A] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
object Utils { | ||
class Box[T] | ||
inline def foo[T](t: T) <: Any = inline t match { | ||
transparent inline def foo[T](t: T): Any = inline t match { | ||
case _: Box[a] => scala.compiletime.constValue[a] | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.