Skip to content

Commit

Permalink
Fixed #109: Upgrade to Scala 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Apr 11, 2024
1 parent 37ced6f commit aede1b4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import indigoplugin.IndigoOptions

Global / onChangedBuildSource := ReloadOnSourceChanges

val scala3Version = "3.3.1"
val scala3Version = "3.4.1"

ThisBuild / versionScheme := Some("early-semver")
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object ShaderPrinter:
render(ast)

@SuppressWarnings(Array("scalafix:DisableSyntax.throw"))
private def render(ast: ShaderAST)(using pp: ShaderPrinter[_]): List[String] =
private def render(ast: ShaderAST)(using pp: ShaderPrinter[?]): List[String] =
val r: ShaderAST => List[String] = {
case Empty() =>
Nil
Expand Down Expand Up @@ -362,7 +362,7 @@ object ShaderPrinter:

p(ast.traverse(pp.transformer.orElse(n => n)))

private def renderStatements(statements: List[ShaderAST])(using pp: ShaderPrinter[_]): List[String] =
private def renderStatements(statements: List[ShaderAST])(using pp: ShaderPrinter[?]): List[String] =
val p =
pp.printer.orElse {
case ShaderAST.RawLiteral(raw) =>
Expand Down Expand Up @@ -397,7 +397,7 @@ object ShaderPrinter:

private def addIndent: String => String = str => " " + str

private def decideType(a: ShaderAST)(using pp: ShaderPrinter[_]): String =
private def decideType(a: ShaderAST)(using pp: ShaderPrinter[?]): String =
a match
case Empty() => "void"
case Block(_) => "void"
Expand Down Expand Up @@ -458,7 +458,7 @@ object ShaderPrinter:
private def processFunctionStatements(
statements: List[ShaderAST],
maybeReturnType: Option[String]
)(using pp: ShaderPrinter[_]): (List[String], String) =
)(using pp: ShaderPrinter[?]): (List[String], String) =
val nonEmpty = statements
.filterNot(_.isEmpty)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object UBOReader:
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[ValueOf[t]].value.asInstanceOf[String] :: summonLabels[ts]

inline private def summonTypeName[T <: Tuple]: List[ShaderTypeOf[_]] =
inline private def summonTypeName[T <: Tuple]: List[ShaderTypeOf[?]] =
inline erasedValue[T] match
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[ShaderTypeOf[t]] :: summonTypeName[ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class GLSLCastingTests extends munit.FunSuite {
test("casting") {
inline def fragment: Shader[Unit, Float] =
Shader { _ =>
val x = 1.0f.toInt
val y = 1.toFloat
val z = y.toInt
val x = 1.0f.toInt // Cast is inlined on literal
val y = 1.toFloat // Cast is inlined on literal
val z = x.toFloat
val zz = y.toInt
val w1 = 2
val w2 = (1 + w1).toFloat
x + y
Expand All @@ -19,12 +20,15 @@ class GLSLCastingTests extends munit.FunSuite {
val actual =
fragment.toGLSL[WebGL2].toOutput.code

// DebugAST.toAST(fragment)

assertEquals(
actual,
s"""
|int x=int(1.0);
|float y=float(1);
|int z=int(y);
|int x=1;
|float y=1.0;
|float z=float(x);
|int zz=int(y);
|int w1=2;
|float w2=float(1+w1);
|x+y;
Expand Down

0 comments on commit aede1b4

Please sign in to comment.