-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: correctly require a ClassTag
when building a multidimensional Array
#23902
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after giving a better name to isGenericArray
.
|
||
@main def Test = | ||
val arr: Array[Array[String]] = MyArray.empty[String] | ||
assert(arr.length == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe test the runtime class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well to assert that it is specialised based on the classtag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this fix, we couldn't even create the array in Line 7, this is a run test witnessing that we are indeed creating the array correctly. Also, dotty will add a call to asInstanceOf[Array[Array[String]]]
here which is enough to assert that the right array is created. Also note that asInstanceOf
was what indicated that something was really wrong it the generated code.
Closes #23901