-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fixes for isLegalPrefix change #22241
Open
dwijnand
wants to merge
4
commits into
scala:main
Choose a base branch
from
dwijnand:i22062-reg-from-isLegalPrefix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,32 @@ | ||
class Label | ||
class Component | ||
|
||
trait RenderableCellsCompanion: | ||
type Renderer[-A] <: CellRenderer[A] | ||
type DefaultRenderer[-A] <: Label & Renderer[A] | ||
|
||
trait CellRendererCompanion: | ||
type CellInfo | ||
def labeled[A](): DefaultRenderer[A] | ||
protected trait LabelRenderer[-A] extends CellRenderer[A]: | ||
override abstract def componentFor(info: companion.CellInfo): Component = super.componentFor(info) | ||
|
||
trait CellRenderer[-A]: | ||
val companion: CellRendererCompanion | ||
def componentFor(cellInfo: companion.CellInfo): Component | ||
|
||
sealed trait TreeRenderers extends RenderableCellsCompanion: | ||
this: Tree.type => | ||
|
||
trait Renderer[-A] extends CellRenderer[A]: | ||
final override val companion = Renderer | ||
|
||
object Renderer extends CellRendererCompanion: | ||
final override class CellInfo | ||
override def labeled[A]() = new DefaultRenderer[A] with LabelRenderer[A] {} | ||
|
||
class DefaultRenderer[-A] extends Label with Renderer[A]: | ||
override def componentFor(info: Renderer.CellInfo): Component = ??? | ||
|
||
class Tree extends Component | ||
object Tree extends TreeRenderers |
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,21 @@ | ||
class A | ||
class B extends A | ||
class C extends A | ||
|
||
object foos: | ||
opaque type Tag[A] = String | ||
object Tag: | ||
inline given mkTag[A]: Tag[A] = ??? | ||
type Full[A] = Tag[A] | Set[A] | ||
sealed trait Set[A] extends Any | ||
case class Union[A](tags: Seq[Tag[Any]]) extends AnyVal with Set[A]: | ||
infix def and[B](t2: Full[B]): Unit = ??? | ||
object Union: | ||
inline given mkUnion[A]: Union[A] = ??? | ||
import foos.Tag.* | ||
|
||
class Test: | ||
inline def m1[K1, K2](using b1: Union[K1], b2: Union[K2]): Unit = | ||
b1.and(b2) | ||
|
||
def t1(): Unit = m1[B | C, A] |
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,29 @@ | ||
trait AnyFreeSpecLike: | ||
inline implicit def convertToFreeSpecStringWrapper(s: String): FreeSpecStringWrapper = ??? | ||
protected final class FreeSpecStringWrapper(string: String): | ||
infix def in(testFun: => Any): Unit = ??? | ||
|
||
|
||
import types.Tag.* | ||
class TagTest extends AnyFreeSpecLike{ | ||
inline def test[T1, T2](using k1: Union[T1], k2: Union[T2]): Unit = | ||
"T1 <:< T2" in { | ||
val kresult = k1 <:< k2 | ||
??? | ||
} | ||
class A | ||
class B extends A | ||
class C extends A | ||
test[B | C, A] | ||
} | ||
|
||
object types: | ||
opaque type Tag[A] = String | ||
object Tag: | ||
inline given apply[A]: Tag[A] = ??? | ||
type Full[A] = Tag[A] | Set[A] | ||
sealed trait Set[A] extends Any | ||
case class Union[A](tags: Seq[Tag[Any]]) extends AnyVal with Set[A]: | ||
infix def <:<[B](t2: Full[B]): Boolean = ??? | ||
object Union: | ||
inline given apply[A]: Union[A] = ??? |
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,14 @@ | ||
object foos: | ||
opaque type Foo[T] = String | ||
object bars: | ||
class Bar1[A] { def and(b: Bar2): Unit = () } | ||
class Bar2 | ||
inline def mkBar1[A]: Bar1[A] = new Bar1[A] | ||
def mkBar2 : Bar2 = new Bar2 | ||
import foos.*, bars.* | ||
|
||
class Test: | ||
inline def m1[X](b1: Bar1[X], b2: Bar2): Unit = | ||
b1.and(b2) | ||
|
||
def t1(): Unit = m1(mkBar1[Int], mkBar2) |
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,18 @@ | ||
trait Featureful[T]: | ||
def toFeatures(value: T): IArray[Float] | ||
|
||
object Featureful: | ||
inline def derived[T](using scala.deriving.Mirror.Of[T]) = ${ derivedImpl[T] } | ||
|
||
import scala.quoted.* | ||
private def derivedImpl[T: Type](using Quotes): Expr[Featureful[T]] = | ||
import quotes.reflect.* | ||
'{ | ||
new Featureful[T]: | ||
def toFeatures(value: T) = | ||
val feats = IArray.empty[Featureful[?]] | ||
val product = value.asInstanceOf[Product] | ||
product.productIterator.zipWithIndex.foreach: (any, idx) => | ||
feats(idx).toFeatures(any.asInstanceOf) | ||
IArray.empty | ||
} |
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 @@ | ||
case class Breaks(x: Boolean, y: Boolean) derives Featureful |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It would be good to be more specific what side effect (error messages?, anything else?)