Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After redundantReturn is on, return is mistakenly deleted, resulting in a serious logical error. #1739

Closed
mlch911 opened this issue Jun 24, 2024 · 9 comments
Labels
bug fixed in develop bug/feature resolved in the develop branch

Comments

@mlch911
Copy link

mlch911 commented Jun 24, 2024

public func findNegativeFeedbackButton() -> NegativeFeedbackButton? {
    let btns = [topView, contentView, bottomView]
        .compactMap { $0 as? NegativeFeedbackCellProtocol }
        .map(\.negativeFeedbackButton)
    if btns.count > 1, let btn = btns.first { !$0.isHidden && $0.alpha > 0.01 } {
        return btn  // <== this return will be deleted...
    }
    return btns.first
}
@nicklockwood
Copy link
Owner

Sorry about that. The issue is due to the closure in the if statement condition causing the if statement body to be mistaken for a closure as well.

A workaround for now it to put parentheses around the { !$0.isHidden && $0.alpha > 0.01 }

@nysander
Copy link

nysander commented Jul 3, 2024

I had similar issue

        let completion: AddItemCompletionBlock? = { [unowned self] (success: Bool, serialNumber: SerialNumber?) in
            Task { @MainActor in
                if let serialNumber,
                   let item = itemRepository.fetch(serialNumber: serialNumber) {
                    self.determineViewToShow(with: item, refresh: true)
                    self.popToHomeScreen(with: serialNumber, refresh: success)
                } else {
                    self.popToHomeScreen()
                }
            }
            return // < THIS IS REMOVED and causes crash
        }

@nicklockwood
Copy link
Owner

@nysander this issue is unrelated - can you open a separate ticket to track it please

@nysander
Copy link

nysander commented Jul 3, 2024

done: #1749

@nicklockwood nicklockwood added the fixed in develop bug/feature resolved in the develop branch label Jul 6, 2024
@nicklockwood
Copy link
Owner

nicklockwood commented Jul 10, 2024

@mlch911 fixed in 0.54.1

@mlch911
Copy link
Author

mlch911 commented Jul 19, 2024

@mlch911 fixed in 0.54.1

I installed 0.54.1, this issue is still there.😂

@mlch911
Copy link
Author

mlch911 commented Jul 19, 2024

public func tabVCIndex(path: RouterPath?, router: Router) -> (Int, UINavigationController)? {
    guard let path, let _ = path as? TabBarRouterPath, path.superPath == nil,
            let tabVC = UIApplication.shared.delegate?.window??.rootViewController as? UITabBarController
    else { return nil }
    let vcs = tabVC.viewControllers?.compactMap { $0 as? UINavigationController }
    if let path_vc = path.vc as? AnyClass, let (index, vc) = vcs?.enumerated().first { $0.element.viewControllers.first?.isMember(of: path_vc) ?? false } {
        return (index, vc)  // <== this return will be deleted...
    }
    return nil
}

@nicklockwood nicklockwood reopened this Jul 19, 2024
@nicklockwood nicklockwood removed the fixed in develop bug/feature resolved in the develop branch label Jul 19, 2024
@nicklockwood
Copy link
Owner

@mlch911 apologies, I oversimplified the test example and so the fix only covered some cases. I'll get this case fixed too

@nicklockwood nicklockwood added the fixed in develop bug/feature resolved in the develop branch label Jul 20, 2024
@nicklockwood
Copy link
Owner

@mlch911 fixed in 0.54.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed in develop bug/feature resolved in the develop branch
Projects
None yet
Development

No branches or pull requests

3 participants