File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -280,7 +280,10 @@ def tryCorrectVDeclType (ty : IRType) (e : Expr) : M IRType :=
280280 match e with
281281 | .fap f _ => do
282282 let decl ← getDecl f
283- return decl.resultType
283+ match decl.name with
284+ | ``FloatArray.size | ``ByteArray.size | ``Array.size | ``String.length | ``String.utf8ByteSize
285+ | ``String.Pos.next | ``UInt8.toNat | ``UInt16.toNat => return .tagged
286+ | _ => return decl.resultType
284287 | .pap .. => return .object
285288 | .uproj .. => return .usize
286289 | .ctor .. | .reuse .. | .ap .. | .lit .. | .sproj .. | .proj .. | .reset .. =>
Original file line number Diff line number Diff line change 1+ /--
2+ trace: [ Compiler.IR ] [ result ]
3+ def test (x_1 : @& obj) : tobj :=
4+ let x_2 : tagged := Array.size ◾ x_1;
5+ let x_3 : tobj := Nat.add x_2 x_2;
6+ ret x_3
7+ def test._boxed (x_1 : obj) : tobj :=
8+ let x_2 : tobj := test x_1;
9+ dec x_1;
10+ ret x_2
11+ -/
12+ #guard_msgs in
13+ set_option trace.compiler.ir.result true in
14+ def test (xs : Array Int) :=
15+ let size := xs.size
16+ size + size
You can’t perform that action at this time.
0 commit comments