[Swift-devel] Returning float from java( ) no longer works

David Kelly davidkelly at uchicago.edu
Sun Apr 6 21:31:42 CDT 2014


In 0.95, this fails:
---
type file;

(float result) pow (float x, float y)
{
    result = java("java.lang.Math", "pow", x, y);
}

float f = pow(2.0, 2.0);
tracef("%f\n", f);
---

But when I replace java() with @java() it works for me...


On Sun, Apr 6, 2014 at 6:20 PM, Michael Wilde <wilde at anl.gov> wrote:

> I'm dusting off some old Swift code and running into errors which seem
> to stem from changes in type checking and/or casting.
>
> This used to work in a prior release (will need to track down which):
>
> (float result) pow (float x, float y)
> {
>     result = java("java.lang.Math", "pow", x, y);
> }
>
> In trunk, it now gives:
>
> Swift trunk swift-r7759 cog-r3890
> RunID: run007
> Could not start execution:
>      Compile error in procedure invocation at line 50:
>      You cannot assign value of type any to a variable of type float
>
> (50 is line before result=...)
>
> Any thoughts on why?
>
> A similar error occurs on string results.
>
> I'll file a ticket.
>
> Thanks,
>
> - Mike
>
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20140406/385dfc91/attachment.html>


More information about the Swift-devel mailing list