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

Size-type error after pass simplify #2104

Closed
FluxusMagna opened this issue Feb 5, 2024 · 1 comment
Closed

Size-type error after pass simplify #2104

FluxusMagna opened this issue Feb 5, 2024 · 1 comment
Assignees

Comments

@FluxusMagna
Copy link

I get an error due to some kind of size-type problem. One part has reduced the expression 10+10+10 to 30 and another hasn't, which creates a mismatch even though they are indeed the same.

Error:

Type error after pass 'simplify':
In function lifted_triangle_5340
When checking function body
When matching declared return type to result of body
Type error:
Type annotation is
  {[d<{(+) ((+) 10 10) 10}>_6693]f32}
But result returns type
  {[30i64]f32}

Code to replicate:

type v3= (f32,f32,f32)
type v4= (f32,f32,f32,f32)
type C4N3V3 = (v4,v3,v3)

let serializeC4N3V3 (((r,g,b,a),(nx,ny,nz),(vx,vy,vz)):C4N3V3)  = [r,g,b,a,nx,ny,nz,vx,vy,vz]

let triangleMeshC4N3V3 [m][n] (vs:[m][n]C4N3V3) : []f32 =
    let triangle v0 v1 v2 = serializeC4N3V3 v0 ++ serializeC4N3V3 v1 ++ serializeC4N3V3 v2
    let quad v0 v1 v2 v3 = triangle v0 v1 v2 ++ triangle v2 v3 v0
    in tabulate_2d (m-1) (n-1) (\i j -> quad vs[i,j] vs[i+1,j] vs[i+1,j+1] vs[i,j+1])
    |> flatten |> flatten

entry particleSystemMesh [m][n][k]
    (vs:[m][n]C4N3V3)
    (coords:[k]v3)
    : []f32
    =  map (\_ -> vs) coords
    |> map triangleMeshC4N3V3
    |> flatten

@athas
Copy link
Member

athas commented Feb 5, 2024

I can reproduce. This is just some simplification error in the core language.

@athas athas self-assigned this Feb 5, 2024
@athas athas closed this as completed in d1ab77e Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants