Skip to content

x/tools/internal/refactor/inline: do not inline a function that directly calls recover() #78193

@adonovan

Description

@adonovan

See https://news.ycombinator.com/item?id=47391964.

We should reject inlining of functions that directly call recover() as this changes their behavior:

 package main
    
    //go:fix inline
    func handle() {
        recover()
    }
    
    func foo() {
        handle() // not safe to inline!
    }
    
    func main() {
        defer foo()
        panic("bye")
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.RefactoringIssues related to refactoring toolsToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions