Skip to content
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

Resolving symbol throws StackOverflow #423

Closed
adpi2 opened this issue Dec 14, 2023 · 0 comments
Closed

Resolving symbol throws StackOverflow #423

adpi2 opened this issue Dec 14, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@adpi2
Copy link
Member

adpi2 commented Dec 14, 2023

In the classpath of "com.typesafe.akka" %% "akka-stream" % "2.8.5":

  1. Find the class symbol of akka.stream.scaladsl.FlowOps
  2. Resolve the member groupBy[K](maxSubstreams: Int, f: Out => K, allowClosedSubstreamRecreation: Boolean): SubFlow[Out, Mat, Repr, Closed]
  3. Find the inner tree that looks like:
via(new GroupBy(maxSubstreams, f, allowClosedSubstreamRecreation)).map(_.via(flow)).via
  1. resolve the symbol of this tree
java.lang.StackOverflowError: null
    at tastyquery.Substituters$SubstParamsMap.transform(Substituters.scala:70)
    at tastyquery.TypeMaps$TypeMap.apply(TypeMaps.scala:32)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:173)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:91)
    at tastyquery.Substituters$SubstParamsMap.transform(Substituters.scala:78)
    at tastyquery.TypeMaps$TypeMap.apply(TypeMaps.scala:32)
    at tastyquery.TypeMaps$TypeMap.$anonfun$1(TypeMaps.scala:74)
    at scala.collection.immutable.List.mapConserve(List.scala:472)
    at tastyquery.TypeMaps$TypeMap.mapOverLambda(TypeMaps.scala:74)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:124)
    at tastyquery.TypeMaps$NormalizingTypeMap.mapOver(TypeMaps.scala:209)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:90)
    at tastyquery.Substituters$SubstParamsMap.transform(Substituters.scala:78)
    at tastyquery.TypeMaps$TypeMap.apply(TypeMaps.scala:32)
    at tastyquery.TypeMaps$TypeMap.op$proxy3$1(TypeMaps.scala:170)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:170)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:91)
    at tastyquery.Substituters$SubstParamsMap.transform(Substituters.scala:78)
    at tastyquery.TypeMaps$TypeMap.apply(TypeMaps.scala:32)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:139)
    at tastyquery.TypeMaps$NormalizingTypeMap.mapOver(TypeMaps.scala:209)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:90)
    at tastyquery.Substituters$SubstParamsMap.transform(Substituters.scala:78)
    at tastyquery.TypeMaps$TypeMap.apply(TypeMaps.scala:32)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:139)
    at tastyquery.TypeMaps$NormalizingTypeMap.mapOver(TypeMaps.scala:209)
    at tastyquery.TypeMaps$TypeMap.mapOver(TypeMaps.scala:90)
    at tastyquery.Substituters$SubstParamsMap.transform(Substituters.scala:78)
    at tastyquery.TypeMaps$TypeMap.apply(TypeMaps.scala:32)
    at tastyquery.Substituters$.substParams(Substituters.scala:16)
    at tastyquery.Types$TypeLambdaType.instantiate(Types.scala:1645)
    at tastyquery.Types$TypeLambdaType.instantiate$(Types.scala:1631)
    at tastyquery.Types$TypeLambda.instantiate(Types.scala:1891)
    at tastyquery.Types$Type.appliedTo(Types.scala:563)
    at tastyquery.Types$Type.applyIfParameterized(Types.scala:574)
    at tastyquery.Types$AppliedType.superType(Types.scala:1459)
@sjrd sjrd self-assigned this Dec 18, 2023
@sjrd sjrd added the bug Something isn't working label Dec 18, 2023
sjrd added a commit to sjrd/tasty-query that referenced this issue Dec 18, 2023
…ding subtyping.

There was an infinite recursion between looking up a type member
of a refinement and subtyping of that member against the same
refinement. This came from computing the merged TypeBounds of the
type member during subtyping, which used subtyping to get rid of
useless bounds.

We break the cycle by not using subtyping when merging the
TypeBounds of a type member anymore. Instead, we manually dive into
possibly-higher-kinded bounds (`TypeLambda`s themselves, but also
`Nothing` and `AnyKind`), and otherwise construction a union or
intersection type.

Unwrapping higher-kinded bounds is necessary because constructing
a uniont or intersection requires proper types.
sjrd added a commit to sjrd/tasty-query that referenced this issue Dec 18, 2023
…ding subtyping.

There was an infinite recursion between looking up a type member
of a refinement and subtyping of that member against the same
refinement. This came from computing the merged TypeBounds of the
type member during subtyping, which used subtyping to get rid of
useless bounds.

We break the cycle by not using subtyping when merging the
TypeBounds of a type member anymore. Instead, we manually dive into
possibly-higher-kinded bounds (`TypeLambda`s themselves, but also
`Nothing` and `AnyKind`), and otherwise construction a union or
intersection type.

Unwrapping higher-kinded bounds is necessary because constructing
a uniont or intersection requires proper types.
@sjrd sjrd closed this as completed in f69ecde Dec 19, 2023
sjrd added a commit that referenced this issue Dec 19, 2023
Fix #423: Merge the TypeBounds of type members without needing subtyping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants