Skip to content

Commit

Permalink
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM ubuntu:14.04

RUN \
apt-get update && \
apt-get install -y apt-transport-https && \
apt-key adv --keyserver keys.gnupg.net --recv-keys 09617FD37CC06B54 && \
echo "deb https://dist.crystal-lang.org/apt crystal main" > /etc/apt/sources.list.d/crystal.list && \
apt-get update && \
12 changes: 12 additions & 0 deletions spec/compiler/type_inference/def_overload_spec.cr
Original file line number Diff line number Diff line change
@@ -881,6 +881,18 @@ describe "Type inference: def overload" do
)) { tuple_of([char, int32]) }
end

it "doesn't crash on unknown metaclass" do
assert_type(%(
def foo(x : Foo.class)
end
def foo(x : Bar.class)
end
1
)) { int32 }
end

it "overloads union against non-union (#2904)" do
assert_type(%(
def foo(x : Int32?)
2 changes: 2 additions & 0 deletions src/compiler/crystal/semantic/type_lookup.cr
Original file line number Diff line number Diff line change
@@ -61,6 +61,8 @@ module Crystal

def visit(node : Metaclass)
node.name.accept self
return false if !@raise && !@type

@type = type.virtual_type.metaclass.virtual_type
false
end

0 comments on commit b87cff7

Please sign in to comment.