aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-08-14 13:54:23 +0000
committers-ol <s-ol@users.noreply.github.com>2020-08-17 09:57:55 +0000
commitce75ca8367ccfb55b2576a81eb8adbb1d91b8930 (patch)
tree53c4749c3bfa13cf5873394ec89bb9e1ea2b27f5
parentspec/lang/do (diff)
downloadalive-ce75ca8367ccfb55b2576a81eb8adbb1d91b8930.tar.gz
alive-ce75ca8367ccfb55b2576a81eb8adbb1d91b8930.zip
bugfixes with compound type comparisons
-rw-r--r--alv/result/evt.moon5
-rw-r--r--alv/type.moon4
2 files changed, 5 insertions, 4 deletions
diff --git a/alv/result/evt.moon b/alv/result/evt.moon
index cdd0e83..90a975a 100644
--- a/alv/result/evt.moon
+++ b/alv/result/evt.moon
@@ -12,7 +12,7 @@ class EvtStream extends Result
--- return whether this Result was changed in the current tick.
-- @treturn bool
- dirty: => @updated == COPILOT.T
+ dirty: => @updated == (COPILOT and COPILOT.T)
--- get the sequence of current events (if any).
--
@@ -37,7 +37,8 @@ class EvtStream extends Result
__call: (...) => @unwrap ...
__tostring: =>
- "<#{@type}#{@metatype} #{if @dirty then @type\pp @value else 'nil'}>"
+ value = if @dirty! then @type\pp @value else 'nil'
+ "<#{@type}#{@metatype} #{value}>"
--- the type of this Result's value.
-- @tfield type.Type type
diff --git a/alv/type.moon b/alv/type.moon
index 1b47b13..4f38e02 100644
--- a/alv/type.moon
+++ b/alv/type.moon
@@ -126,7 +126,7 @@ class Struct extends Type
types[key] = @types[key]
@@ types
- __eq: (other) => same @types, other.types
+ __eq: (other) => other.__class == Struct and same @types, other.types
__tostring: =>
inner = table.concat ["#{k}: #{v}" for k, v in opairs @types], ' '
"{#{inner}}"
@@ -161,7 +161,7 @@ class Array extends Type
assert key >= 0 and key < @size, Error 'index', "index '#{key}' out of range!"
@type
- __eq: (other) => @size == other.size and @type == other.type
+ __eq: (other) => other.__class == Array and @size == other.size and @type == other.type
__tostring: => "#{@type}[#{@size}]"
--- instantiate an Array type.