nitc :: MContract :: no_intro_contract
# Method use to diplay warning when the contract is not present at the introduction
private fun no_intro_contract(v: ContractsVisitor, a: Array[AAnnotation])do end
src/contracts.nit:281,2--282,80
# Display warning if no contract is defined at introduction `expect`,
# because if no contract is defined at the introduction the added
# contracts will not cause any error even if they are not satisfied.
#
# Example:
# ~~~nitish
# class A
# fun bar [...]
# fun _bar_expect([...])
# do
# [empty contract]
# end
# end
#
# redef class A
# redef fun bar is expect(contract_condition)
# redef fun _bar_expect([...])
# do
# if (contract_condition) then return
# super
# end
# end
# ~~~~
#
redef fun no_intro_contract(v: ContractsVisitor, a: Array[AAnnotation])
do
v.toolcontext.warning(a.first.location,"useless_contract","Useless contract: No contract defined at the introduction of the method")
end
src/contracts.nit:385,2--412,4