-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for isLegalPrefix change (#22241)
- Loading branch information
Showing
10 changed files
with
173 additions
and
19 deletions.
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 |