Skip to content

Target Type Propagation #20

@DavePearce

Description

@DavePearce

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 ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions