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

Target Type Propagation #20

Open
DavePearce opened this issue Sep 27, 2017 · 0 comments
Open

Target Type Propagation #20

DavePearce opened this issue Sep 27, 2017 · 0 comments

Comments

@DavePearce
Copy link
Member

Consider the following Whiley function:

function f(int[] xs) -> (int[] rs):
   xs[0] = 0
   return xs

This currently compiles to the following Java:

public static BigInteger[] f(BigInteger[] xs) {
    xs[BigInteger.valueOf(0L).intValue()] = BigInteger.valueOf(0L);
    return xs;
}

The basic issue is that from the array access we want to propagate forwards the fact that it is expecting a Java int. This could then be used when translating the constant to produce this:

   xs[0] = ...

There are presumably other situations when this might be useful ...

@DavePearce DavePearce changed the title Implement Target Type Propagation Target Type Propagation Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant