Skip to content

Commit

Permalink
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/compiler/semantic/restrictions_spec.cr
Original file line number Diff line number Diff line change
@@ -397,4 +397,14 @@ describe "Restrictions" do
foo(Parent || Child)
)) { types["Parent"].metaclass.virtual_type! }
end

it "doesn't crash on invalid splat restriction (#3698)" do
assert_error %(
def foo(arg : *String)
end
foo(1)
),
"no overload matches"
end
end
4 changes: 4 additions & 0 deletions src/compiler/crystal/semantic/restrictions.cr
Original file line number Diff line number Diff line change
@@ -426,6 +426,10 @@ module Crystal
nil
end

def restrict(other : Splat, context)
nil
end

def restrict(other : ASTNode, context)
raise "Bug: unsupported restriction: #{self} vs. #{other}"
end

0 comments on commit 0c6cd7a

Please sign in to comment.