From e4336e03b0205eac3e3ff1d8efb6e61840cad5fd Mon Sep 17 00:00:00 2001 From: Aaron Christiansen Date: Thu, 19 Dec 2024 21:22:30 +0000 Subject: [PATCH] Fix new Sorbet type error on suffix-if usage --- lib/parlour/rbi_generator/constant.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/parlour/rbi_generator/constant.rb b/lib/parlour/rbi_generator/constant.rb index 9bab631ec..f3ecc784f 100644 --- a/lib/parlour/rbi_generator/constant.rb +++ b/lib/parlour/rbi_generator/constant.rb @@ -102,9 +102,11 @@ def describe_attrs sig { override.void } def generalize_from_rbi! - # There's a good change this is an untyped constant, so rescue - # ParseError and use untyped - @value = (TypeParser.parse_single_type(@value) if String === @value) rescue Types::Untyped.new + if @value.is_a?(String) + # There's a good chance this is an untyped constant, so rescue + # ParseError and use untyped + @value = TypeParser.parse_single_type(@value) rescue Types::Untyped.new + end end end end