Prevent ugly "has no type" errors

This commit is contained in:
Michael Miller 2022-03-12 11:33:56 -07:00
parent 12eeb02a8d
commit 554e215898
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF

View file

@ -68,6 +68,7 @@ module Spectator
arguments = ::Spectator::Arguments.capture({{call.args.splat(", ")}}{% if call.named_args %}{{call.named_args.splat}}{% end %})
call = ::Spectator::MethodCall.new({{call.name.symbolize}}, arguments)
raise ::Spectator::UnexpectedMessage.new("#{_spectator_double_name} received unexpected message :{{call.name}} with #{arguments}")
nil # Necessary for compiler to infer return type as nil. Avoids runtime "can't execute ... `x` has no type errors".
end
end
end