Revert "Compiler bug when using unsafe_as"

This reverts commit cb89589155.
This commit is contained in:
Michael Miller 2023-01-26 16:12:54 -07:00
parent cb89589155
commit 7149ef7df5
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2

View file

@ -550,7 +550,7 @@ module Spectator
# Check if nil was returned by the stub and if its okay to return it.
if %value.nil? && %type.nilable?
# Value was nil and nil is allowed to be returned.
%cast.unsafe_as({{type}})
%type.cast(%cast)
elsif %cast.nil?
# The stubbed value was something else entirely and cannot be cast to the return type.
raise TypeCastError.new("#{_spectator_stubbed_name} received message #{ {{call}} } and is attempting to return a `#{%value.class}`, but returned type must be `#{%type}`.")