Skip to content

Commit

Permalink
Merge pull request Shopify#223 from Shopify/vs/use_unsafe_nil
Browse files Browse the repository at this point in the history
Use unsafe nil for default values
  • Loading branch information
vinistock authored Feb 16, 2024
2 parents 5aceafc + 47f6610 commit 2658baf
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions rbi/annotations/activesupport.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ class String
end

class ActiveSupport::ErrorReporter
# The `source` parameter should actually point to the `DEFAULT_SOURCE` constant, but that doesn't
# exist for older versions of Rails, so we're inlining the string directly
sig do
type_parameters(:Block, :Fallback)
.params(
Expand All @@ -443,10 +441,8 @@ class ActiveSupport::ErrorReporter
)
.returns(T.any(T.type_parameter(:Block), T.type_parameter(:Fallback)))
end
def handle(*error_classes, severity: :warning, context: {}, fallback: nil, source: "application", &blk); end
def handle(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), fallback: T.unsafe(nil), source: T.unsafe(nil), &blk); end

# The `source` parameter should actually point to the `DEFAULT_SOURCE` constant, but that doesn't
# exist for older versions of Rails, so we're inlining the string directly
sig do
type_parameters(:Block)
.params(
Expand All @@ -458,10 +454,8 @@ class ActiveSupport::ErrorReporter
)
.returns(T.type_parameter(:Block))
end
def record(*error_classes, severity: :error, context: {}, source: "application", &blk); end
def record(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil), &blk); end

# The `source` parameter should actually point to the `DEFAULT_SOURCE` constant, but that doesn't
# exist for older versions of Rails, so we're inlining the string directly
sig do
params(
error: Exception,
Expand All @@ -471,5 +465,5 @@ class ActiveSupport::ErrorReporter
source: T.nilable(String),
).void
end
def report(error, handled: true, severity: handled ? :warning : :error, context: {}, source: "application"); end
def report(error, handled: true, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end
end

0 comments on commit 2658baf

Please sign in to comment.