Skip to content

Commit

Permalink
Underscore issue reporter type names (#112)
Browse files Browse the repository at this point in the history
* Underscore issue reporter type names

The big issue here is that `FatalErrorReporter` takes precedence in
autocomplete over Swift's `fatalError` and is quite an annoyance when
importing our library.

These probably should have never been prominent when the preferred
spelling is `.fatalError`, etc.

This is a breaking bug fix change with fix-its.

* wip
  • Loading branch information
stephencelis authored Aug 8, 2024
1 parent c94005c commit 0b9e076
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 27 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions Sources/IssueReporting/Internal/Deprecations.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// NB: Deprecated after 1.2.2

#if canImport(Darwin)
@available(*, unavailable, renamed: "_BreakpointReporter")
public typealias BreakpointReporter = _BreakpointReporter
#endif

@available(*, unavailable, renamed: "_FatalErrorReporter")
public typealias FatalErrorReporter = _FatalErrorReporter

@available(*, unavailable, renamed: "_RuntimeWarningReporter")
public typealias RuntimeWarningReporter = _RuntimeWarningReporter
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if canImport(Darwin)
import Darwin

extension IssueReporter where Self == BreakpointReporter {
extension IssueReporter where Self == _BreakpointReporter {
/// An issue reporter that pauses program execution when a debugger is attached.
///
/// Logs a warning to the console and raises `SIGTRAP` when an issue is received.
Expand All @@ -12,7 +12,7 @@
/// attached.
///
/// Use ``IssueReporter/breakpoint`` to create one of these values.
public struct BreakpointReporter: IssueReporter {
public struct _BreakpointReporter: IssueReporter {
public func reportIssue(
_ message: @autoclosure () -> String?,
fileID: StaticString,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extension IssueReporter where Self == FatalErrorReporter {
extension IssueReporter where Self == _FatalErrorReporter {
/// An issue reporter that terminates program execution.
///
/// Calls Swift's `fatalError` function when an issue is received.
Expand All @@ -8,7 +8,7 @@ extension IssueReporter where Self == FatalErrorReporter {
/// A type representing an issue reporter that terminates program execution.
///
/// Use ``IssueReporter/fatalError`` to create one of these values.
public struct FatalErrorReporter: IssueReporter {
public struct _FatalErrorReporter: IssueReporter {
public func reportIssue(
_ message: @autoclosure () -> String?,
fileID: StaticString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
import os
#endif

extension IssueReporter where Self == RuntimeWarningReporter {
extension IssueReporter where Self == _RuntimeWarningReporter {
/// An issue reporter that emits "purple" runtime warnings to Xcode and logs fault-level messages
/// to the console.
///
Expand All @@ -22,7 +22,7 @@ extension IssueReporter where Self == RuntimeWarningReporter {
/// fault-level messages to the console.
///
/// Use ``IssueReporter/runtimeWarning`` to create one of these values.
public struct RuntimeWarningReporter: IssueReporter {
public struct _RuntimeWarningReporter: IssueReporter {
#if canImport(os)
@UncheckedSendable
#if canImport(Darwin)
Expand Down

0 comments on commit 0b9e076

Please sign in to comment.