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

Examine the Suffix hint on integers to apply apropriate TyTy type. #122

Merged
merged 1 commit into from
Jan 6, 2021

Conversation

philberty
Copy link
Member

@philberty philberty commented Jan 5, 2021

This change propagates the PrimitiveCoreType to AST and HIR so the suffix can be examined.

fn main() {
    let a1: i8 = 1i8;
    let a2: i16 = 2i16;
    let a3: i32 = 3i32;
    let a4: i64 = 4i64;
    let a5: i128 = 5i128;

    let b1 = 1i8;
    let b2 = 2i16;
    let b3 = 3i32;
    let b4 = 4i64;
    let b5 = 5i128;

    let c1: u8 = 1u8;
    let c2: u16 = 2u16;
    let c3: u32 = 3u32;
    let c4: u64 = 4u64;
    let c5: u128 = 5u128;

    let d1 = 1u8;
    let d2 = 2u16;
    let d3 = 3u32;
    let d4 = 4u64;
    let d5 = 5u128;
}
void main ()
{
  i8 a1;
  i16 a2;
  i32 a3;
  i64 a4;
  i128 a5;
  i8 b1;
  i16 b2;
  i32 b3;
  i64 b4;
  i128 b5;
  i8 c1;
  i16 c2;
  i32 c3;
  u64 c4;
  u128 c5;
  i8 d1;
  i16 d2;
  i32 d3;
  u64 d4;
  u128 d5;

  a1 = 1;
  a2 = 2;
  a3 = 3;
  a4 = 4;
  a5 = 5;
  b1 = 1;
  b2 = 2;
  b3 = 3;
  b4 = 4;
  b5 = 5;
  c1 = 1;
  c2 = 2;
  c3 = 3;
  c4 = 4;
  c5 = 5;
  d1 = 1;
  d2 = 2;
  d3 = 3;
  d4 = 4;
  d5 = 5;
}

This change propagates the PrimitiveCoreType to AST and HIR so
the suffix can be examined.
@philberty philberty added this to the Core Datastructures milestone Jan 5, 2021
@philberty philberty linked an issue Jan 5, 2021 that may be closed by this pull request
Copy link
Member

@SimplyTheOther SimplyTheOther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks great.

@philberty philberty merged commit 1a97dbc into master Jan 6, 2021
@philberty philberty deleted the phil/int-suffix-rules branch January 6, 2021 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suffix on integer literals can enforce the type
2 participants