Compiler bug when using unsafe_as

This commit is contained in:
Michael Miller 2023-01-25 16:09:16 -07:00
parent a5e8f11e11
commit cb89589155
No known key found for this signature in database
GPG Key ID: AC78B32D30CE34A2
1 changed files with 1 additions and 1 deletions

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.
%type.cast(%cast)
%cast.unsafe_as({{type}})
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}`.")