Breaking brain


(Roman Pastushkov) #1

Hello everyone!

I iam trying compile 4 lines prog on linux:

import Foundation
let filemgr = FileManager.default
let path = filemgr.currentDirectoryPath()
print(path)

and get erorr /main.swift:3:40: error: cannot call value of non-function type 'String'
let path = filemgr.currentDirectoryPath()
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                       
<unknown>:0: error: build had 1 command failures

why?
Roman Pastushkov
xnucleargeminix@aol.com


(Chris Eidhof) #2

The error tells you it's not a function, but a String. In other words, it's
a property of filemgr. Try calling it without the parentheses :).

···

On Wed, Feb 1, 2017 at 10:34 AM, Roman Pastushkov via swift-dev < swift-dev@swift.org> wrote:

Hello everyone!

I iam trying compile 4 lines prog on linux:
import Foundation
let filemgr = FileManager.default
let path = filemgr.currentDirectoryPath()
print(path)

and get erorr /main.swift:3:40: error: cannot call value of non-function
type 'String'
let path = filemgr.currentDirectoryPath()
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

<unknown>:0: error: build had 1 command failures

why?
Roman Pastushkov
xnucleargeminix@aol.com

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

--
Chris Eidhof


(Joe Groff) #3

This is the kind of thing it'd be a good idea to have a fixit for. If either of you have time to file a bug to improve the diagnostic to suggest a fix, we'd appreciate it!

-Joe

···

On Feb 1, 2017, at 2:33 AM, Chris Eidhof via swift-dev <swift-dev@swift.org> wrote:

The error tells you it's not a function, but a String. In other words, it's a property of filemgr. Try calling it without the parentheses :).


(Saleem Abdulrasool) #4

>
> The error tells you it's not a function, but a String. In other words,
it's a property of filemgr. Try calling it without the parentheses :).

This is the kind of thing it'd be a good idea to have a fixit for. If
either of you have time to file a bug to improve the diagnostic to suggest
a fix, we'd appreciate it!

The original change actually emits the fixit. I also verified that the
-fixit-all emits a fix it to .remap.

···

On Wed, Feb 1, 2017 at 10:24 AM, Joe Groff via swift-dev < swift-dev@swift.org> wrote:

> On Feb 1, 2017, at 2:33 AM, Chris Eidhof via swift-dev < > swift-dev@swift.org> wrote:

-Joe
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

--
Saleem Abdulrasool
compnerd (at) compnerd (dot) org