Skip to content

Stack overflow on subtype of large union for IArray[String] literal #7034

Closed
@ryanberckmans

Description

@ryanberckmans

minimized code

With dotty 0.17.0-RC1

// This code produces the compiler error below
val Names = IArray(
  "Aaliyah",
  "Aaron",
  // ... 5000 more names as string literals
)

// This code triggers the same compile error
val Names: IArray[String] = IArray(/* 5000 names */)

// This code compiles successfully
val Names = IArray[String](/* 5000 names */)


[error] 2 |val Names = IArray(
[error]   |                                      ^
[error]   |Recursion limit exceeded.
[error]   |Maybe there is an illegal cyclic reference?
[error]   |If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
[error]   |A recurring operation is (inner to outer):
[error]   |
[error]   |  subtype ... | ... | ... | ...(...) | ...(...) | String("Winnie") | String("Winnifred") |
[error]   |
[error]   |String("Winona") | String("Winston") | String("Winter") | String("Wm") |
[error]   |  String("Wonda")

expectation

Expected this code to compile:

IArray("Aaliyah", "Aaron", /* 5000 more names */)```

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions