diff --git a/community-build/community-projects/onnx-scala b/community-build/community-projects/onnx-scala index 64cb918ea298..ff0c47297fd2 160000 --- a/community-build/community-projects/onnx-scala +++ b/community-build/community-projects/onnx-scala @@ -1 +1 @@ -Subproject commit 64cb918ea298ba2a9410d99d4dd565cdeed79b3e +Subproject commit ff0c47297fd2885f8b56def3ea4fd22efdfe1e8b diff --git a/community-build/community-projects/scodec b/community-build/community-projects/scodec index 8d7f83ae76e3..84db5f776573 160000 --- a/community-build/community-projects/scodec +++ b/community-build/community-projects/scodec @@ -1 +1 @@ -Subproject commit 8d7f83ae76e3278245631126d808c9c02e57ae23 +Subproject commit 84db5f7765738024aebd8df2bf53151cc6d4d793 diff --git a/community-build/community-projects/shapeless b/community-build/community-projects/shapeless index 273524d806fc..4909c064e0d1 160000 --- a/community-build/community-projects/shapeless +++ b/community-build/community-projects/shapeless @@ -1 +1 @@ -Subproject commit 273524d806fc38a4fdfff27550c3fb3720716754 +Subproject commit 4909c064e0d140b35efedf7fb9cbbd8ab5b09f8a diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 916a5132e48e..410c72aaf1c5 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -222,15 +222,15 @@ class Definitions { @tu lazy val ScalaXmlPackageClass: Symbol = getPackageClassIfDefined("scala.xml") - @tu lazy val CompiletimePackageObject: Symbol = requiredModule("scala.compiletime.package") - @tu lazy val Compiletime_codeOf: Symbol = CompiletimePackageObject.requiredMethod("codeOf") - @tu lazy val Compiletime_erasedValue : Symbol = CompiletimePackageObject.requiredMethod("erasedValue") - @tu lazy val Compiletime_uninitialized: Symbol = CompiletimePackageObject.requiredMethod("uninitialized") - @tu lazy val Compiletime_error : Symbol = CompiletimePackageObject.requiredMethod(nme.error) - @tu lazy val Compiletime_requireConst : Symbol = CompiletimePackageObject.requiredMethod("requireConst") - @tu lazy val Compiletime_constValue : Symbol = CompiletimePackageObject.requiredMethod("constValue") - @tu lazy val Compiletime_constValueOpt: Symbol = CompiletimePackageObject.requiredMethod("constValueOpt") - @tu lazy val Compiletime_summonFrom : Symbol = CompiletimePackageObject.requiredMethod("summonFrom") + @tu lazy val CompiletimePackageClass: Symbol = requiredPackage("scala.compiletime").moduleClass + @tu lazy val Compiletime_codeOf: Symbol = CompiletimePackageClass.requiredMethod("codeOf") + @tu lazy val Compiletime_erasedValue : Symbol = CompiletimePackageClass.requiredMethod("erasedValue") + @tu lazy val Compiletime_uninitialized: Symbol = CompiletimePackageClass.requiredMethod("uninitialized") + @tu lazy val Compiletime_error : Symbol = CompiletimePackageClass.requiredMethod(nme.error) + @tu lazy val Compiletime_requireConst : Symbol = CompiletimePackageClass.requiredMethod("requireConst") + @tu lazy val Compiletime_constValue : Symbol = CompiletimePackageClass.requiredMethod("constValue") + @tu lazy val Compiletime_constValueOpt: Symbol = CompiletimePackageClass.requiredMethod("constValueOpt") + @tu lazy val Compiletime_summonFrom : Symbol = CompiletimePackageClass.requiredMethod("summonFrom") @tu lazy val CompiletimeTestingPackage: Symbol = requiredPackage("scala.compiletime.testing") @tu lazy val CompiletimeTesting_typeChecks: Symbol = CompiletimeTestingPackage.requiredMethod("typeChecks") @tu lazy val CompiletimeTesting_typeCheckErrors: Symbol = CompiletimeTestingPackage.requiredMethod("typeCheckErrors") @@ -241,10 +241,10 @@ class Definitions { @tu lazy val CompiletimeTesting_ErrorKind_Parser: Symbol = CompiletimeTesting_ErrorKind.requiredMethod("Parser") @tu lazy val CompiletimeTesting_ErrorKind_Typer: Symbol = CompiletimeTesting_ErrorKind.requiredMethod("Typer") @tu lazy val CompiletimeOpsPackage: Symbol = requiredPackage("scala.compiletime.ops") - @tu lazy val CompiletimeOpsAny: Symbol = requiredModule("scala.compiletime.ops.any") - @tu lazy val CompiletimeOpsInt: Symbol = requiredModule("scala.compiletime.ops.int") - @tu lazy val CompiletimeOpsString: Symbol = requiredModule("scala.compiletime.ops.string") - @tu lazy val CompiletimeOpsBoolean: Symbol = requiredModule("scala.compiletime.ops.boolean") + @tu lazy val CompiletimeOpsAnyModuleClass: Symbol = requiredModule("scala.compiletime.ops.any").moduleClass + @tu lazy val CompiletimeOpsIntModuleClass: Symbol = requiredModule("scala.compiletime.ops.int").moduleClass + @tu lazy val CompiletimeOpsStringModuleClass: Symbol = requiredModule("scala.compiletime.ops.string").moduleClass + @tu lazy val CompiletimeOpsBooleanModuleClass: Symbol = requiredModule("scala.compiletime.ops.boolean").moduleClass /** Note: We cannot have same named methods defined in Object and Any (and AnyVal, for that matter) * because after erasure the Any and AnyVal references get remapped to the Object methods @@ -1049,7 +1049,7 @@ class Definitions { } final def isCompiletime_S(sym: Symbol)(using Context): Boolean = - sym.name == tpnme.S && sym.owner == CompiletimePackageObject.moduleClass + sym.name == tpnme.S && sym.owner == CompiletimeOpsIntModuleClass private val compiletimePackageAnyTypes: Set[Name] = Set(tpnme.Equals, tpnme.NotEquals) private val compiletimePackageIntTypes: Set[Name] = Set( @@ -1070,11 +1070,11 @@ class Definitions { final def isCompiletimeAppliedType(sym: Symbol)(using Context): Boolean = compiletimePackageOpTypes.contains(sym.name) && ( - sym.owner == CompiletimePackageObject.moduleClass && sym.name == tpnme.S - || sym.owner == CompiletimeOpsAny.moduleClass && compiletimePackageAnyTypes.contains(sym.name) - || sym.owner == CompiletimeOpsInt.moduleClass && compiletimePackageIntTypes.contains(sym.name) - || sym.owner == CompiletimeOpsBoolean.moduleClass && compiletimePackageBooleanTypes.contains(sym.name) - || sym.owner == CompiletimeOpsString.moduleClass && compiletimePackageStringTypes.contains(sym.name) + isCompiletime_S(sym) + || sym.owner == CompiletimeOpsAnyModuleClass && compiletimePackageAnyTypes.contains(sym.name) + || sym.owner == CompiletimeOpsIntModuleClass && compiletimePackageIntTypes.contains(sym.name) + || sym.owner == CompiletimeOpsBooleanModuleClass && compiletimePackageBooleanTypes.contains(sym.name) + || sym.owner == CompiletimeOpsStringModuleClass && compiletimePackageStringTypes.contains(sym.name) ) // ----- Scala-2 library patches -------------------------------------- diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 72fcd284b924..1bc75e4fec20 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -4059,14 +4059,14 @@ object Types { val owner = tycon.symbol.owner val nArgs = args.length val constantType = - if (owner == defn.CompiletimePackageObject.moduleClass) name match { - case tpnme.S if nArgs == 1 => constantFold1(natValue, _ + 1) - case _ => None - } else if (owner == defn.CompiletimeOpsAny.moduleClass) name match { + if (defn.isCompiletime_S(tycon.symbol)) { + if (nArgs == 1) constantFold1(natValue, _ + 1) + else None + } else if (owner == defn.CompiletimeOpsAnyModuleClass) name match { case tpnme.Equals if nArgs == 2 => constantFold2(constValue, _ == _) case tpnme.NotEquals if nArgs == 2 => constantFold2(constValue, _ != _) case _ => None - } else if (owner == defn.CompiletimeOpsInt.moduleClass) name match { + } else if (owner == defn.CompiletimeOpsIntModuleClass) name match { case tpnme.Abs if nArgs == 1 => constantFold1(intValue, _.abs) case tpnme.Negate if nArgs == 1 => constantFold1(intValue, x => -x) case tpnme.ToString if nArgs == 1 => constantFold1(intValue, _.toString) @@ -4094,10 +4094,10 @@ object Types { case tpnme.Min if nArgs == 2 => constantFold2(intValue, _ min _) case tpnme.Max if nArgs == 2 => constantFold2(intValue, _ max _) case _ => None - } else if (owner == defn.CompiletimeOpsString.moduleClass) name match { + } else if (owner == defn.CompiletimeOpsStringModuleClass) name match { case tpnme.Plus if nArgs == 2 => constantFold2(stringValue, _ + _) case _ => None - } else if (owner == defn.CompiletimeOpsBoolean.moduleClass) name match { + } else if (owner == defn.CompiletimeOpsBooleanModuleClass) name match { case tpnme.Not if nArgs == 1 => constantFold1(boolValue, x => !x) case tpnme.And if nArgs == 2 => constantFold2(boolValue, _ && _) case tpnme.Or if nArgs == 2 => constantFold2(boolValue, _ || _) diff --git a/docs/docs/reference/metaprogramming/inline.md b/docs/docs/reference/metaprogramming/inline.md index 28d9bf5a89cf..c38f5cde8248 100644 --- a/docs/docs/reference/metaprogramming/inline.md +++ b/docs/docs/reference/metaprogramming/inline.md @@ -381,13 +381,14 @@ val intTwo: 2 = natTwo The `scala.compiletime` package contains helper definitions that provide support for compile time operations over values. They are described in the following. -### `constValue`, `constValueOpt`, and the `S` combinator +### `constValue` and `constValueOpt` `constValue` is a function that produces the constant value represented by a type. ```scala -import scala.compiletime.{constValue, S} +import scala.compiletime.constValue +import scala.compiletime.ops.int.S transparent inline def toIntC[N]: Int = inline constValue[N] match diff --git a/library/src-bootstrapped/scala/compiletime/ops/int.scala b/library/src-bootstrapped/scala/compiletime/ops/int.scala new file mode 100644 index 000000000000..0aa390ce29fd --- /dev/null +++ b/library/src-bootstrapped/scala/compiletime/ops/int.scala @@ -0,0 +1,184 @@ +package scala.compiletime +package ops + +object int: + /** Successor of a natural number where zero is the type 0 and successors are reduced as if the definition was + * + * ```scala + * type S[N <: Int] <: Int = N match { + * case 0 => 1 + * case 1 => 2 + * case 2 => 3 + * ... + * case 2147483646 => 2147483647 + * } + * ``` + * @syntax markdown + */ + type S[N <: Int] <: Int + + /** Addition of two `Int` singleton types. + * ```scala + * val sum: 2 + 2 = 4 + * ``` + * @syntax markdown + */ + type +[X <: Int, Y <: Int] <: Int + + /** Subtraction of two `Int` singleton types. + * ```scala + * val sub: 4 - 2 = 2 + * ``` + * @syntax markdown + */ + type -[X <: Int, Y <: Int] <: Int + + /** Multiplication of two `Int` singleton types. + * ```scala + * val mul: 4 * 2 = 8 + * ``` + * @syntax markdown + */ + type *[X <: Int, Y <: Int] <: Int + + /** Integer division of two `Int` singleton types. + * ```scala + * val div: 5 / 2 = 2 + * ``` + * @syntax markdown + */ + type /[X <: Int, Y <: Int] <: Int + + /** Remainder of the division of `X` by `Y`. + * ```scala + * val mod: 5 % 2 = 1 + * ``` + * @syntax markdown + */ + type %[X <: Int, Y <: Int] <: Int + + /** Binary left shift of `X` by `Y`. + * ```scala + * val lshift: 1 << 2 = 4 + * ``` + * @syntax markdown + */ + type <<[X <: Int, Y <: Int] <: Int + + /** Binary right shift of `X` by `Y`. + * ```scala + * val rshift: 10 >> 1 = 5 + * ``` + * @syntax markdown + */ + type >>[X <: Int, Y <: Int] <: Int + + /** Binary right shift of `X` by `Y`, filling the left with zeros. + * ```scala + * val rshiftzero: 10 >>> 1 = 5 + * ``` + * @syntax markdown + */ + type >>>[X <: Int, Y <: Int] <: Int + + /** Bitwise xor of `X` and `Y`. + * ```scala + * val xor: 10 ^ 30 = 20 + * ``` + * @syntax markdown + */ + type ^[X <: Int, Y <: Int] <: Int + + /** Less-than comparison of two `Int` singleton types. + * ```scala + * val lt1: 4 < 2 = false + * val lt2: 2 < 4 = true + * ``` + * @syntax markdown + */ + type <[X <: Int, Y <: Int] <: Boolean + + /** Greater-than comparison of two `Int` singleton types. + * ```scala + * val gt1: 4 > 2 = true + * val gt2: 2 > 2 = false + * ``` + * @syntax markdown + */ + type >[X <: Int, Y <: Int] <: Boolean + + /** Greater-or-equal comparison of two `Int` singleton types. + * ```scala + * val ge1: 4 >= 2 = true + * val ge2: 2 >= 3 = false + * ``` + * @syntax markdown + */ + type >=[X <: Int, Y <: Int] <: Boolean + + /** Less-or-equal comparison of two `Int` singleton types. + * ```scala + * val lt1: 4 <= 2 = false + * val lt2: 2 <= 2 = true + * ``` + * @syntax markdown + */ + type <=[X <: Int, Y <: Int] <: Boolean + + /** Bitwise and of `X` and `Y`. + * ```scala + * val and1: BitwiseAnd[4, 4] = 4 + * val and2: BitwiseAnd[10, 5] = 0 + * ``` + * @syntax markdown + */ + type BitwiseAnd[X <: Int, Y <: Int] <: Int + + /** Bitwise or of `X` and `Y`. + * ```scala + * val or: BitwiseOr[10, 11] = 11 + * ``` + * @syntax markdown + */ + type BitwiseOr[X <: Int, Y <: Int] <: Int + + /** Absolute value of an `Int` singleton type. + * ```scala + * val abs: Abs[-1] = 1 + * ``` + * @syntax markdown + */ + type Abs[X <: Int] <: Int + + /** Negation of an `Int` singleton type. + * ```scala + * val neg1: Neg[-1] = 1 + * val neg2: Neg[1] = -1 + * ``` + * @syntax markdown + */ + type Negate[X <: Int] <: Int + + /** Minimum of two `Int` singleton types. + * ```scala + * val min: Min[-1, 1] = -1 + * ``` + * @syntax markdown + */ + type Min[X <: Int, Y <: Int] <: Int + + /** Maximum of two `Int` singleton types. + * ```scala + * val max: Max[-1, 1] = 1 + * ``` + * @syntax markdown + */ + type Max[X <: Int, Y <: Int] <: Int + + /** String conversion of an `Int` singleton type. + * ```scala + * val abs: ToString[1] = "1" + * ``` + * @syntax markdown + */ + type ToString[X <: Int] <: String diff --git a/library/src-bootstrapped/scala/compiletime/package.scala b/library/src-bootstrapped/scala/compiletime/package.scala new file mode 100644 index 000000000000..e3ddedc38a7f --- /dev/null +++ b/library/src-bootstrapped/scala/compiletime/package.scala @@ -0,0 +1,159 @@ +package scala +package compiletime + +import annotation.compileTimeOnly + +/** Use this method when you have a type, do not have a value for it but want to + * pattern match on it. For example, given a type `Tup <: Tuple`, one can + * pattern-match on it as follows: + * ```scala + * inline erasedValue[Tup] match { + * case _: EmptyTuple => ... + * case _: h *: t => ... + * } + * ``` + * This value can only be used in an inline match and the value cannot be used in + * the branches. + * @syntax markdown + */ +erased def erasedValue[T]: T = ??? + +/** Used as the initializer of a mutable class or object field, like this: + * + * var x: T = uninitialized + * + * This signifies that the field is not initialized on its own. It is still initialized + * as part of the bulk initialization of the object it belongs to, which assigns zero + * values such as `null`, `0`, `0.0`, `false` to all object fields. + */ +@compileTimeOnly("`uninitialized` can only be used as the right hand side of a mutable field definition") +def uninitialized: Nothing = ??? + +/** The error method is used to produce user-defined compile errors during inline expansion. + * If an inline expansion results in a call error(msgStr) the compiler produces an error message containing the given msgStr. + * + * ```scala + * error("My error message") + * ``` + * or + * ```scala + * inline def errorOnThisCode(inline x: Any) = + * error("My error of this code: " + codeOf(x)) + * ``` + * @syntax markdown + */ +inline def error(inline msg: String): Nothing = ??? + +/** Returns the string representation of argument code: + * + * ```scala + * inline def logged(inline p1: Any) = + * ("code: " + codeOf(p1), p1) + * + * logged(identity("foo")) + * // above is equivalent to: + * // ("code: scala.Predef.identity("foo")", identity("foo")) + * ``` + * + * The formatting of the code is not stable across version of the compiler. + * + * @note only `inline` arguments will be displayed as "code". + * Other values may display unintutively. + * + * @syntax markdown + */ +transparent inline def codeOf(arg: Any): String = + // implemented in dotty.tools.dotc.typer.Inliner.Intrinsics + error("Compiler bug: `codeOf` was not evaluated by the compiler") + +/** Checks at compiletime that the provided values is a constant after + * inlining and constant folding. + * + * Usage: + * ```scala + * inline def twice(inline n: Int): Int = + * requireConst(n) // compile-time assertion that the parameter `n` is a constant + * n + n + * + * twice(1) + * val m: Int = ... + * twice(m) // error: expected a constant value but found: m + * ``` + * @syntax markdown + */ +inline def requireConst(inline x: Boolean | Byte | Short | Int | Long | Float | Double | Char | String): Unit = + // implemented in dotty.tools.dotc.typer.Inliner + error("Compiler bug: `requireConst` was not evaluated by the compiler") + +/** Same as `constValue` but returns a `None` if a constant value + * cannot be constructed from the provided type. Otherwise returns + * that value wrapped in `Some`. + */ +transparent inline def constValueOpt[T]: Option[T] = + // implemented in dotty.tools.dotc.typer.Inliner + error("Compiler bug: `constValueOpt` was not evaluated by the compiler") + +/** Given a constant, singleton type `T`, convert it to a value + * of the same singleton type. For example: `assert(constValue[1] == 1)`. + */ +transparent inline def constValue[T]: T = + // implemented in dotty.tools.dotc.typer.Inliner + error("Compiler bug: `constValue` was not evaluated by the compiler") + +/** Given a tuple type `(X1, ..., Xn)`, returns a tuple value + * `(constValue[X1], ..., constValue[Xn])`. + */ +inline def constValueTuple[T <: Tuple]: T = + val res = + inline erasedValue[T] match + case _: EmptyTuple => EmptyTuple + case _: (t *: ts) => constValue[t] *: constValueTuple[ts] + end match + res.asInstanceOf[T] +end constValueTuple + +/** Summons first given matching one of the listed cases. E.g. in + * + * ```scala + * given B { ... } + * + * summonFrom { + * case given A => 1 + * case given B => 2 + * case given C => 3 + * case _ => 4 + * } + * ``` + * the returned value would be `2`. + * @syntax markdown + */ +transparent inline def summonFrom[T](f: Nothing => T): T = + error("Compiler bug: `summonFrom` was not evaluated by the compiler") + +/** Summon a given value of type `T`. Usually, the argument is not passed explicitly. + * The summoning is delayed until the call has been fully inlined. + * + * @tparam T the type of the value to be summoned + * @return the given value typed as the provided type parameter + */ +transparent inline def summonInline[T]: T = summonFrom { + case t: T => t +} + +/** Given a tuple T, summons each of its member types and returns them in + * a Tuple. + * + * @tparam T the tuple containing the types of the values to be summoned + * @return the given values typed as elements of the tuple + */ +inline def summonAll[T <: Tuple]: T = + val res = + inline erasedValue[T] match + case _: EmptyTuple => EmptyTuple + case _: (t *: ts) => summonInline[t] *: summonAll[ts] + end match + res.asInstanceOf[T] +end summonAll + +/** Assertion that an argument is by-name. Used for nullability checking. */ +def byName[T](x: => T): T = x diff --git a/library/src/scala/compiletime/ops/int.scala b/library/src-non-bootstrapped/scala/compiletime/ops/int.scala similarity index 100% rename from library/src/scala/compiletime/ops/int.scala rename to library/src-non-bootstrapped/scala/compiletime/ops/int.scala diff --git a/library/src/scala/compiletime/package.scala b/library/src-non-bootstrapped/scala/compiletime/package.scala similarity index 100% rename from library/src/scala/compiletime/package.scala rename to library/src-non-bootstrapped/scala/compiletime/package.scala diff --git a/library/src/scala/Tuple.scala b/library/src/scala/Tuple.scala index 843279733668..5e69db4fc5af 100644 --- a/library/src/scala/Tuple.scala +++ b/library/src/scala/Tuple.scala @@ -1,6 +1,7 @@ package scala import annotation.showAsInfix import compiletime._ +import compiletime.ops.int._ /** Tuple of arbitrary arity */ sealed trait Tuple extends Product { diff --git a/tests/neg/i6606.scala b/tests/neg/i6606.scala index 74847e2e6f53..f1961b486218 100644 --- a/tests/neg/i6606.scala +++ b/tests/neg/i6606.scala @@ -1,8 +1,8 @@ val t0: Int = 0 -val t1: scala.compiletime.S[-1] = 0 // error -val t2: scala.compiletime.S[Int] = 1 -val t3: scala.compiletime.S[Int] = 0 // error -val t4: scala.compiletime.S[Int] = t0 // error +val t1: scala.compiletime.ops.int.S[-1] = 0 // error +val t2: scala.compiletime.ops.int.S[Int] = 1 +val t3: scala.compiletime.ops.int.S[Int] = 0 // error +val t4: scala.compiletime.ops.int.S[Int] = t0 // error -val t5: scala.compiletime.S[2147483647] = -2147483648 // error -val t6: scala.compiletime.S[-2147483648] = -2147483647 // error +val t5: scala.compiletime.ops.int.S[2147483647] = -2147483648 // error +val t6: scala.compiletime.ops.int.S[-2147483648] = -2147483647 // error diff --git a/tests/pos-custom-args/erased/i7868.scala b/tests/pos-custom-args/erased/i7868.scala index c8034adf993d..02d6ad0e7ca6 100644 --- a/tests/pos-custom-args/erased/i7868.scala +++ b/tests/pos-custom-args/erased/i7868.scala @@ -1,5 +1,6 @@ import language.experimental.namedTypeArguments import scala.compiletime.* +import scala.compiletime.ops.int.* final case class Coproduct[+Set, +Value, Index <: Int](value: Value & Set, index: Index) @@ -35,6 +36,6 @@ object Coproduct { object Test extends App { import Coproduct.* - // Error: No singleton value available for scala.compiletime.S[scala.compiletime.S[(0 : Int)]]. + // Error: No singleton value available for scala.compiletime.ops.int.S[scala.compiletime.ops.int.S[(0 : Int)]]. val c = from[Set = Int +: String +: Seq[Double] +: Nothing](Nil) } diff --git a/tests/pos/6709.scala b/tests/pos/6709.scala index 038cbcab8957..005a314482d8 100644 --- a/tests/pos/6709.scala +++ b/tests/pos/6709.scala @@ -22,7 +22,7 @@ object Foo { } object Bar { - import compiletime.S + import compiletime.ops.int.S type Plus[A <: Int, B <: Int] <: Int = A match { diff --git a/tests/pos/i11247.scala b/tests/pos/i11247.scala index bf3f9c3bd393..43a35380a685 100644 --- a/tests/pos/i11247.scala +++ b/tests/pos/i11247.scala @@ -1,5 +1,6 @@ import annotation.showAsInfix import scala.compiletime._ +import scala.compiletime.ops.int._ class TupleKOps { @@ -50,4 +51,4 @@ type EmptyTupleK = EmptyTupleK.type object EmptyTupleK extends TupleK sealed trait NonEmptyTupleK extends TupleK -sealed abstract class #:[+H, +T <: TupleK] extends NonEmptyTupleK \ No newline at end of file +sealed abstract class #:[+H, +T <: TupleK] extends NonEmptyTupleK diff --git a/tests/pos/reference/compile-time.scala b/tests/pos/reference/compile-time.scala index 32ea7660c898..9539af50968b 100644 --- a/tests/pos/reference/compile-time.scala +++ b/tests/pos/reference/compile-time.scala @@ -1,7 +1,8 @@ package compiletime class Test: - import scala.compiletime.{constValue, erasedValue, S} + import scala.compiletime.{constValue, erasedValue} + import scala.compiletime.ops.int.S trait Nat case object Zero extends Nat diff --git a/tests/pos/singleton-ops-test-issue-8280.scala b/tests/pos/singleton-ops-test-issue-8280.scala index e57a07877cb5..85e15355ca02 100644 --- a/tests/pos/singleton-ops-test-issue-8280.scala +++ b/tests/pos/singleton-ops-test-issue-8280.scala @@ -1,5 +1,5 @@ import scala.compiletime.ops.int.* -import scala.compiletime.S +import scala.compiletime.ops.int.S class Foo[T <: Int] { def incP = new Foo[T + 1] diff --git a/tests/run/enum-nat.scala b/tests/run/enum-nat.scala index 4367785ea754..dde0208ccf7d 100644 --- a/tests/run/enum-nat.scala +++ b/tests/run/enum-nat.scala @@ -1,5 +1,6 @@ import Nat.* import compiletime.* +import compiletime.ops.int.* enum Nat: case Zero diff --git a/tests/run/i7868.scala b/tests/run/i7868.scala index 9b866dfd951c..edbb8515f68f 100644 --- a/tests/run/i7868.scala +++ b/tests/run/i7868.scala @@ -1,4 +1,4 @@ -import scala.compiletime.S +import scala.compiletime.ops.int.S object Test extends App { def plusOne[I <: Int](using x: ValueOf[S[I]]): S[I] = x.value diff --git a/tests/run/singleton-ops-flags.scala b/tests/run/singleton-ops-flags.scala index 08f26d1faea0..667c43251b07 100644 --- a/tests/run/singleton-ops-flags.scala +++ b/tests/run/singleton-ops-flags.scala @@ -1,6 +1,6 @@ package example { - import compiletime.S + import compiletime.ops.int.S import compiletime.ops.int.<< object TastyFlags: diff --git a/tests/run/typelevel-peano.scala b/tests/run/typelevel-peano.scala index 069686f6d95c..f944bb6a81dd 100644 --- a/tests/run/typelevel-peano.scala +++ b/tests/run/typelevel-peano.scala @@ -1,5 +1,6 @@ import compiletime.* +import compiletime.ops.int.* object Test extends App {