Skip to content

Commit

Permalink
fix: type resolution when checking for nilable types
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Nov 15, 2019
1 parent 2d38282 commit c0f56be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: bindata
version: 1.1.7
version: 1.1.8

development_dependencies:
ameba:
Expand Down
4 changes: 2 additions & 2 deletions src/bindata.cr
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class BinData
{% if part[0] == "basic" %}
{% part_type = part[2].resolve %}
{% if part_type.is_a?(Union) %}
@{{part[1]}} = io.read_bytes({{part[2].types[0]}}, __format__)
@{{part[1]}} = io.read_bytes({{part_type.types[0]}}, __format__)
{% elsif part_type.union? %}
@{{part[1]}} = io.read_bytes({{part[2].union_types[0]}}, __format__)
@{{part[1]}} = io.read_bytes({{part_type.union_types[0]}}, __format__)
{% else %}
@{{part[1]}} = io.read_bytes({{part[2]}}, __format__)
{% end %}
Expand Down

0 comments on commit c0f56be

Please sign in to comment.