Commit 07fae1e5 authored by Guy Watson's avatar Guy Watson
Browse files

Add 'number' super-type for when a non-specific but singular type is wanted

parent 674d8af0
......@@ -226,18 +226,21 @@
(+ 1 depth))))]
[Func (λ (n c) (+ 1 (att-value 'nesting-level (ast-parent n))))])
;; Subtype group - use when all types are valid, but only ONE is wanted
;; Use with (fresh-subtype-of 'value)
(define number (base-type 'number))
;; All the base types of WebAssembly
(define i32 (base-type 'i32))
(define i64 (base-type 'i64))
(define f32 (base-type 'f32))
(define f64 (base-type 'f64))
;; Larger groups
(define i32 (base-type 'i32 number))
(define i64 (base-type 'i64 number))
(define f32 (base-type 'f32 number))
(define f64 (base-type 'f64 number))
;; Larger groups - use when ALL the contained types are valid
(define (fresh-number) (fresh-type-variable i32 i64 f32 f64))
(define (fresh-int) (fresh-type-variable i32 i64))
(define (fresh-float) (fresh-type-variable f32 f64))
(define (no-child-types)
(λ (n t) (hash)))
......@@ -298,7 +301,7 @@
[Comparison [i32
(λ (n t) ;; The type of the children is unconstrained, they just have to be the same
(define child-type (number))
(define child-type (fresh-subtype-of 'number))
(hash 'l child-type
'r child-type))]]
[Testop [i32
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment