Skip to content

[SR-2921] Some implicitly coerced from <x> to Any warnings missing a source location #45515

@swift-ci

Description

@swift-ci
Previous ID SR-2921
Radar rdar://problem/28722908
Original Reporter benasher44 (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

macOS Sierra
Swift 3.0.1
Xcode 8.1b3

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee benasher44 (JIRA)
Priority Medium

md5: 83cc0bca9622db0226c0caa1153a1c2b

relates to:

  • SR-2928 Collection casts from collections of optionals to collections of Any need custom handling

Issue Description:

The result from compiling a few different files in our project is warnings emitted in Xcode that look like this:

<unknown>:0: warning: expression implicitly coerced from 'String?' to Any
<unknown>:0: note: provide a default value to avoid this warning
<unknown>:0: note: force-unwrap the value to avoid this warning
<unknown>:0: note: explicitly cast to Any with 'as Any' to silence this warning
<unknown>:0: warning: expression implicitly coerced from 'String?' to Any
<unknown>:0: note: provide a default value to avoid this warning
<unknown>:0: note: force-unwrap the value to avoid this warning
<unknown>:0: note: explicitly cast to Any with 'as Any' to silence this warning
<unknown>:0: warning: expression implicitly coerced from 'String?' to Any
<unknown>:0: note: provide a default value to avoid this warning
<unknown>:0: note: force-unwrap the value to avoid this warning
<unknown>:0: note: explicitly cast to Any with 'as Any' to silence this warning

I've gone through and explicitly unwrapped as many String!/? s as I can identify, but I can't seem to get these to go away. I've tried coming up with a small repro case, since I can't attach the files in question, but so far I haven't figured out what triggers this. We have about 13 of them like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselftype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions