Skip to content

[chore]: Add regression tests for #23237 #23405

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

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/pos/i23237a.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
sealed trait Dim
trait _2D extends Dim
trait _3D extends Dim

sealed abstract class IntVector[D]
object IntVector{
def apply[D](d: Array[Int]): IntVector[D] = ???
def apply(x: Int, y: Int): IntVector2D = IntVector2D(x, y)
def apply(x: Int, y: Int, z: Int): IntVector3D = IntVector3D(x, y, z)
}
case class IntVector2D(i: Int, j: Int) extends IntVector[_2D]
case class IntVector3D(i: Int, j: Int, k: Int) extends IntVector[_3D]

type DiscreteImage[D, A] = DiscreteField[D, DiscreteImageDomain, A]
class DiscreteField[D, DDomain[D] <: DiscreteDomain[D], A](val domain: DDomain[D], val data: IndexedSeq[A]) extends PartialFunction[PointId, A] {
override def apply(v1: PointId) = ???
override def isDefinedAt(ptId: PointId) = ???
}
object DiscreteField{
implicit class DiscreteImageOps[D, A](discreteField: DiscreteField[D, DiscreteImageDomain, A]) {
def apply(idx: IntVector[D]): A = ???
def isDefinedAt(idx: IntVector[D]): Boolean = ???
}
}
trait DiscreteDomain[D]
trait DiscreteImageDomain[D] extends DiscreteDomain[D]
final case class PointId(id: Int) extends AnyVal

def test[S](img: DiscreteImage[_3D, S]) = img(IntVector(1, 2, 3))
23 changes: 23 additions & 0 deletions tests/pos/i23237b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
object types{
final case class vec2(x: Float, y: Float)
final case class vec4(x: Float, y: Float, z: Float, w: Float)
object vec4:
def apply(xy: vec2, z: Float, w: Float): vec4 = vec4(xy.x, xy.y, z, w)

opaque type Shader[In, Out] = In => Out
object Shader:
inline def apply[In, Out](f: In => Out): Shader[In, Out] = f
inline def apply[In](f: In => Unit): Shader[In, Unit] = f
inline def apply(body: => Any): Shader[Unit, Unit] = (_: Unit) => body
}
import types.*

class GLSLEnvTests {
case class FragEnv(UV: vec2)

inline def fragment: Shader[FragEnv, vec4] =
Shader { env =>
val x = env.UV
vec4(env.UV, 0.0f, 1.0f)
}
}
Loading