aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-01-21 17:31:21 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-26 11:59:39 +0000
commit0817c29a423aca1c4c3f9ba812f67df35f36fc65 (patch)
tree942c0d79f3f5063361fb0cae8057bb8ab8b29940 /gcc/rust/resolve
parent5294dfe7dce7a58fbaf2131c7589d115008ebf0e (diff)
downloadgcc-0817c29a423aca1c4c3f9ba812f67df35f36fc65.zip
gcc-0817c29a423aca1c4c3f9ba812f67df35f36fc65.tar.gz
gcc-0817c29a423aca1c4c3f9ba812f67df35f36fc65.tar.bz2
Add Integer and Float InterenceVariable
In order to properly handle all integer types and infer we must follow HM algorithm. This means when we unify every type in the resolver this should keep a chain of HirId of references such that when/if the type is resolved it lookup tables can be updated for the Backend to compile to Gimple. Consider the case: fn test(x:u32) -> u32 {...} let a = test(1); The VarDecl here will have the type let a:<I?> = test<u32>(1<I?>). Since this integer combines with the parameter x:u32 the type resolver knows at this point these must be a u32. let a; a = 1; let b:u32 = a; This is more subtle let a:<?> a:<?> = 1<I?> let b:u32 = a<I?>; Since the integer inference variable combines with u32 all previous references can be updated to u32 at this point. In the basic case of: let a; a = 1; This resolves down to: let a:<I?>; a<I?> = 1<I?> It is not until we complete type-inference we can iterate all the resolved types and HirIds and default any <I?> to i32 and any <F?> to f32. Any remaining general inference variable are errors.
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions