Skip to content

Further regression with a Recursion Limit Exceeded error #16311

@jchyb

Description

@jchyb

Regression reproduced based on the failure in Open CB #17825. Problem found in sangria-graphql/sangria

Compiler version

3.2.2-RC1-bin-20221103-bf808b3-NIGHTLY

Minimized code

trait Tagged[U]
type WithTag[+T, U] = T & Tagged[U]

trait FromInput[Val]
implicit def coercedScalaInput[T]: FromInput[WithTag[T, Int]] = ???
implicit def optionInput[T](implicit ev: FromInput[T]): FromInput[Option[T]] = ???

trait WithoutInputTypeTags[T]
implicit def coercedOptArgTpe[T]: WithoutInputTypeTags[Option[WithTag[T, Int]]] = ???

trait InputType[+T]
class OptionInputType[T](ofType: InputType[T]) extends InputType[Option[T]]

type Argument[T]
def argument[T](argumentType: InputType[T])(implicit fromInput: FromInput[T], res: WithoutInputTypeTags[T]): Argument[Option[T]] = ???

def test = argument(OptionInputType(??? : InputType[WithTag[Boolean, Int]]))

Output

-- Error: sangria.scala:17:4 ---------------------------------------------------
17 |def test = argument(OptionInputType(??? : InputType[WithTag[Boolean, Int]]))
   |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |Recursion limit exceeded.
   |Maybe there is an illegal cyclic reference?
   |If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
   |For the unprocessed stack trace, compile with -Yno-decode-stacktraces.
   |A recurring operation is (inner to outer):
   |
   |  check fully defined T
   |  check fully defined T & Tagged[Int]
   |  check fully defined T & Tagged[Int]
   |  check fully defined T & Tagged[Int] & Tagged[Int]
   |  check fully defined Option[T & Tagged[Int] & Tagged[Int]]
   |  check fully defined Option[Option[T & Tagged[Int] & Tagged[Int]]]
   |  check fully defined Argument[Option[Option[T & Tagged[Int] & Tagged[Int]]]]

Expectation

Should compile, as it did before in 3.2.1. This issue is ver closely related to #15365, to the point where I could basically reuse the minimization, except now the issue is unrelated to the typings introduced by the :: class . Simply trying to create an Argument object is enough to trigger the error (which also means the workarounds sangria used for the previous error will no longer work). The bisect script has shown efdfe0e to be the first problematic commit.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions