Skip to content

Commit 21bf3c9

Browse files
committed
Normalizer: do not drop internal ascriptions
Fixes #2452
1 parent 5a9099c commit 21bf3c9

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/typechecker/FStarC.TypeChecker.Normalize.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ let rec norm : cfg -> env -> stack -> term -> term =
12971297
let t1 = norm cfg env [] t1 in
12981298
log cfg (fun () -> BU.print_string "+++ Normalizing ascription \n");
12991299
let asc = norm_ascription cfg env asc in
1300-
rebuild cfg env stack (mk (Tm_ascribed {tm=U.unascribe t1; asc; eff_opt=l}) t.pos)
1300+
rebuild cfg env stack (mk (Tm_ascribed {tm=t1; asc; eff_opt=l}) t.pos)
13011301
)
13021302

13031303
| Tm_match {scrutinee=head; ret_opt=asc_opt; brs=branches; rc_opt=lopt} ->

tests/bug-reports/closed/Bug2452.fst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Bug2452
2+
3+
[@@expect_failure]
4+
let f () : int = (-1) <: nat
5+
6+
[@@expect_failure]
7+
let f x : bool = true <: (b:bool{false})
8+
9+
[@@expect_failure]
10+
let g (x : bool) : bool = x <: (b:bool{false})
11+
12+
(* This works, h is just inferred to have a refined type. *)
13+
let h x : bool = x <: (b:bool{false})
14+
15+
[@@expect_failure]
16+
let q = f true
17+
18+
[@@expect_failure]
19+
let z : bool = true <: (b:bool{false})

0 commit comments

Comments
 (0)