Commit 5d3ca27
committed
Const-check inline-refined top-level constants at compile time
A constant declared with an inline refined signature (x : Int 1 where \a ->
a > 1) and a literal body was not checked: the inline Refined annotation
erases to its base type in ast_type_to_ty, so the nominal refined-type
introduction guard never fired and a violating literal silently inhabited the
refined type. Evaluate the predicate against a literal or named-const body at
the declaration binding and report a compile error when it fails.1 parent 1445883 commit 5d3ca27
1 file changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11815 | 11815 | | |
11816 | 11816 | | |
11817 | 11817 | | |
| 11818 | + | |
| 11819 | + | |
| 11820 | + | |
| 11821 | + | |
| 11822 | + | |
| 11823 | + | |
| 11824 | + | |
| 11825 | + | |
| 11826 | + | |
| 11827 | + | |
| 11828 | + | |
| 11829 | + | |
| 11830 | + | |
| 11831 | + | |
| 11832 | + | |
| 11833 | + | |
| 11834 | + | |
| 11835 | + | |
| 11836 | + | |
| 11837 | + | |
| 11838 | + | |
| 11839 | + | |
11818 | 11840 | | |
11819 | 11841 | | |
11820 | 11842 | | |
| |||
0 commit comments