-
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.
Merge pull request #13783 from dotty-staging/fix-#13044
Improve message when -Xmax-inlines limit reached
- Loading branch information
Showing
5 changed files
with
155 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- Error: tests/neg/i13044.scala:50:40 --------------------------------------------------------------------------------- | ||
50 | implicit def typeSchema: Schema[A] = Schema.gen // error // error | ||
| ^^^^^^^^^^ | ||
| given instance gen is declared as `inline`, but was not inlined | ||
| | ||
| Try increasing `-Xmax-inlines` above 32 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:18 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
-- Error: tests/neg/i13044.scala:50:40 --------------------------------------------------------------------------------- | ||
50 | implicit def typeSchema: Schema[A] = Schema.gen // error // error | ||
| ^^^^^^^^^^ | ||
| method recurse is declared as `inline`, but was not inlined | ||
| | ||
| Try increasing `-Xmax-inlines` above 32 | ||
| This location contains code that was inlined from i13044.scala:18 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 | ||
| This location contains code that was inlined from i13044.scala:17 | ||
| This location contains code that was inlined from i13044.scala:18 | ||
| This location contains code that was inlined from i13044.scala:31 | ||
| This location contains code that was inlined from i13044.scala:37 |
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,51 @@ | ||
import scala.deriving.Mirror | ||
import scala.compiletime._ | ||
|
||
trait Schema[T] { | ||
def build: T | ||
} | ||
|
||
object Schema extends SchemaDerivation { | ||
implicit lazy val int: Schema[Int] = ??? | ||
implicit def option[A](implicit ev: Schema[A]): Schema[Option[A]] = ??? | ||
} | ||
|
||
trait SchemaDerivation { | ||
inline def recurse[A <: Tuple]: List[Schema[Any]] = | ||
inline erasedValue[A] match { | ||
case _: (t *: ts) => | ||
val builder = summonInline[Schema[t]].asInstanceOf[Schema[Any]] | ||
builder :: recurse[ts] | ||
case _: EmptyTuple => Nil | ||
} | ||
|
||
inline def derived[A]: Schema[A] = | ||
inline summonInline[Mirror.Of[A]] match { | ||
case m: Mirror.SumOf[A] => | ||
lazy val subTypes = recurse[m.MirroredElemTypes] | ||
new Schema[A] { | ||
def build: A = ??? | ||
} | ||
|
||
case m: Mirror.ProductOf[A] => | ||
lazy val fields = recurse[m.MirroredElemTypes] | ||
new Schema[A] { | ||
def build: A = ??? | ||
} | ||
} | ||
|
||
inline given gen[A]: Schema[A] = derived | ||
} | ||
|
||
case class H(i: Int) | ||
case class G(h: H) | ||
case class F(g: G) | ||
case class E(f: Option[F]) | ||
case class D(e: E) | ||
case class C(d: D) | ||
case class B(c: C) | ||
case class A(a: A, b: B) | ||
|
||
object TestApp { | ||
implicit def typeSchema: Schema[A] = Schema.gen // error // error | ||
} |
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,51 @@ | ||
import scala.deriving.Mirror | ||
import scala.compiletime._ | ||
|
||
trait Schema[T] { | ||
def build: T | ||
} | ||
|
||
object Schema extends SchemaDerivation { | ||
implicit lazy val int: Schema[Int] = ??? | ||
implicit def option[A](implicit ev: Schema[A]): Schema[Option[A]] = ??? | ||
} | ||
|
||
trait SchemaDerivation { | ||
inline def recurse[A <: Tuple]: List[Schema[Any]] = | ||
inline erasedValue[A] match { | ||
case _: (t *: ts) => | ||
val builder = summonInline[Schema[t]].asInstanceOf[Schema[Any]] | ||
builder :: recurse[ts] | ||
case _: EmptyTuple => Nil | ||
} | ||
|
||
inline def derived[A]: Schema[A] = | ||
inline summonInline[Mirror.Of[A]] match { | ||
case m: Mirror.SumOf[A] => | ||
lazy val subTypes = recurse[m.MirroredElemTypes] | ||
new Schema[A] { | ||
def build: A = ??? | ||
} | ||
|
||
case m: Mirror.ProductOf[A] => | ||
lazy val fields = recurse[m.MirroredElemTypes] | ||
new Schema[A] { | ||
def build: A = ??? | ||
} | ||
} | ||
|
||
inline given gen[A]: Schema[A] = derived | ||
} | ||
|
||
case class H(i: Int) | ||
case class G(h: H) | ||
case class F(g: G) | ||
case class E(f: Option[F]) | ||
case class D(e: E) | ||
case class C(d: D) | ||
case class B(c: C) | ||
case class A(a: A, b: B) | ||
|
||
object TestApp { | ||
implicit def typeSchema: Schema[A] = Schema.gen | ||
} |