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

[SR-2276] Default argument value of scoped function crash #44883

Closed
swift-ci opened this issue Aug 4, 2016 · 0 comments
Closed

[SR-2276] Default argument value of scoped function crash #44883

swift-ci opened this issue Aug 4, 2016 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 4, 2016

Previous ID SR-2276
Radar None
Original Reporter racer1988 (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 46b8d567c431f8e667a5f73f5a685d81

duplicates:

  • SR-2189 Nested function with local default value crashes

Issue Description:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /Users/***/Library/Developer/Xcode/DerivedData/****-hfmagvhgn/Build/Intermediates/****.build/Debug-iphonesimulator/*****.build/Objects-normal/i386/****** (No such file or directory)

Compiler crash when a nested function uses as default value of one of the argument, a variable declared in the parent scope.

The crash happens only if the inner function is called with the default argument

This compilation issue (if real) should be highlighted as a real-time compilation issue instead of crashing at build time?

// This Works fine
  var testVariable: String {
    let iWillMakeTheCompilerCrash: String = "the crashing variable"
    
    func innerFunctionWithDefaultArgument(iCrashOnCompilation: String = "") {
    
    }
    
    innerFunctionWithDefaultArgument()
    
    return ""
  }
// This will crash due to the default variable

  var testVariable: String {
    let iWillMakeTheCompilerCrash: String = "the crashing variable"
    
    func innerFunctionWithDefaultArgument(iCrashOnCompilation: String = iWillMakeTheCompilerCrash) {
    
    }
    
    innerFunctionWithDefaultArgument()
    
    return ""
  }
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant