ISLE: handle out-of-order extern converter decls. (#4079)
This fixes a bug where the ISLE compiler would refuse to accept out-of-order declarations in the order of: (i) use of an implicit conversion backed by an extern constructor; (ii) extern declaration for that constructor. The issue was one of phase separation: we were capturing and noting "extern constructor" status on terms in the same pass in which we were typechecking and resolving implicit conversions. Given this knowledge, the fix is straightforward: externs are picked up in a prior pass.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
(type T (primitive T))
|
||||
(type U (primitive U))
|
||||
(type V (primitive V))
|
||||
|
||||
(convert T U t_to_u)
|
||||
|
||||
(type Result (enum (T (u U) (v V))))
|
||||
|
||||
;; Use the implicit converter before the underlying constructor is
|
||||
;; declared (below). Also use one of the conversions before it is
|
||||
;; declared (below).
|
||||
(decl entry (T) Result)
|
||||
(rule (entry t)
|
||||
(Result.T t t))
|
||||
|
||||
(convert T V t_to_v)
|
||||
|
||||
(decl t_to_u (T) U)
|
||||
(extern constructor t_to_u t_to_u)
|
||||
|
||||
(decl t_to_v (T) V)
|
||||
(rule (t_to_v _) 0)
|
||||
Reference in New Issue
Block a user