capy-language / capy

🍊 A statically typed, compiled programming language, largely inspired by Jai, Odin, and Zig.
Apache License 2.0
64 stars 4 forks source link

`assertion 'left != right'` failed in `crates/hir_ty/src/resolved_ty.rs:404` #7

Closed lenawanel closed 1 year ago

lenawanel commented 1 year ago

crashing input:

Vector :: distinct[1];
my_point: Vector={};

x := [] i32 { 3f + my_point };

the last array assignment has to be of the size of Vector. I don't fully understand what

my_point: Vector={};

and

3f + my_point

does

bt:

// snip
   4: hir_ty::resolved_ty::ResolvedTy::can_fit_into
             at ./crates/hir_ty/src/resolved_ty.rs:404:9
   5: hir_ty::resolved_ty::ResolvedTy::can_fit_into
             at ./crates/hir_ty/src/resolved_ty.rs:454:49
   6: hir_ty::resolved_ty::ResolvedTy::has_semantics_of
             at ./crates/hir_ty/src/resolved_ty.rs:553:9
   7: hir_ty::resolved_ty::ResolvedTy::has_semantics_of
             at ./crates/hir_ty/src/resolved_ty.rs:543:20
   8: hir_ty::resolved_ty::ResolvedTy::max
             at ./crates/hir_ty/src/resolved_ty.rs:371:20
   9: <hir::body::BinaryOp as hir_ty::resolved_ty::BinaryOutput>::get_possible_output_ty
             at ./crates/hir_ty/src/resolved_ty.rs:641:9
  10: hir_ty::ctx::<impl hir_ty::InferenceCtx>::infer_expr
             at ./crates/hir_ty/src/ctx.rs:930:42
  11: hir_ty::ctx::<impl hir_ty::InferenceCtx>::finish_body_unknown
             at ./crates/hir_ty/src/ctx.rs:108:9
  12: hir_ty::InferenceCtx::get_global_signature
             at ./crates/hir_ty/src/lib.rs:317:26
  13: hir_ty::InferenceCtx::finish
             at ./crates/hir_ty/src/lib.rs:270:21
  14: capy::compile_file
             at ./crates/capy/src/main.rs:261:39
// snip