Uploaded image for project: 'Swift'
  1. Swift
  2. SR-12518

Couldn't lookup symbols error when using default function argument in REPL.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: LLDB for Swift
    • Labels:
      None
    • Environment:

      Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
      macOS 10.15.4 (19E266)

      Description

      It is not possible to declare a function with a default argument and then call it without providing a value for the default argument in the REPL. Doing so will result in a symbol lookup error for the default argument.

      Minimal example:

      $ swift
      Welcome to Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29).
      Type :help for assistance.
        1> func foo(bar: Int = 42) { 
        2.     print(bar) 
        3. } 
        4> foo()
      error: Couldn't lookup symbols:
        default argument 0 of __lldb_expr_1.foo(bar: Swift.Int) -> ()
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            palle Palle Klewitz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: