Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions spec/compiler/semantic/warnings_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ describe "Semantic: warnings" do
end
end

it "ignores nested calls to deprecated methods" do
x = assert_warning <<-CRYSTAL,
@[Deprecated]
def foo; bar; end

@[Deprecated]
def bar; end

foo
CRYSTAL
"warning in line 7\nWarning: Deprecated top-level foo."
end

it "errors if invalid argument type" do
assert_error <<-CRYSTAL,
@[Deprecated(42)]
Expand Down
4 changes: 3 additions & 1 deletion src/compiler/crystal/semantic/cleanup_transformer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ module Crystal
return expanded.transform self
end

@program.check_call_to_deprecated_method(node)
unless @current_def.try(&.annotation(@program.deprecated_annotation))
@program.check_call_to_deprecated_method(node)
end

# Need to transform these manually because node.block doesn't
# need to be transformed if it has a fun_literal
Expand Down