-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cannot find method IndexedSeqView.updated
when running a program compiled with CC stdlib
#19819
Comments
I think it's because at runtime we use the normal stdlib, where there is no |
This is the difference in the bytecode 44: invokestatic #54 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
- 47: invokeinterface #60, 3 // InterfaceMethod scala/collection/IndexedSeqView.updated:(ILjava/lang/Object;)Ljava/lang/Object;
+ 47: invokeinterface #60, 3 // InterfaceMethod scala/collection/IndexedSeqView.updated:(ILjava/lang/Object;)Lscala/collection/View;
52: invokevirtual #64 // Method scala/Predef$.println:(Ljava/lang/Object;)V |
This added a an override for the unapply method to fix the signature, but this method does not exist in the original library. We inline all calls to it to avoid any runtime calls to this new override. Fixes scala#19819
Which is which? |
The one that returns a View is using the CC library. That signature corresponds to the addition new override added in https://github.com/lampepfl/dotty/pull/19798/files#diff-1557066ce6e57518a7fa5d6138de6a2a431ecc6baf30fcf1e423c73cf99b340eR51 Inlining it seems to work (#19824). It is not an ideal solution as it will duplicate the implementation of |
Or maybe we can massage the return type by going through some abstract type. E.g.
Would that work? |
We have to say I attempted another fix here. Do you think that is a good idea? |
Not ure it will work, but it's worth a try! |
I confirm that it works. So maybe we could use this scheme for other methods that need to be added as well? |
This added a an override for the unapply method to fix the signature, but this method does not exist in the original library. We inline all calls to it to avoid any runtime calls to this new override. Fixes scala#19819
Compiler version
main
Minimized code
Steps to reproduce (assuming that the code is saved as
Hello.scala
):Output
Expectation
It should run.
The text was updated successfully, but these errors were encountered: