Skip to content

[SR-4811] Type's name can be assigned a value #47388

@masters3d

Description

@masters3d
Previous ID SR-4811
Radar None
Original Reporter @masters3d
Type Bug
Environment

Swift version 3.1 (swiftlang-802.0.51 clang-802.0.41

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 91be8b3f253fd92bb0bf138ca675e353

relates to:

  • SR-1687 Swift does not warn about shadowing

Issue Description:

I recently learned that swifts allow variable names to shadow type names.
This is very surprising. Is this an intended feature?

let Void = "what?"
struct S {}
let S = 10

I've never run into this personally because I use swiftLint to force lowercase naming for variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions