swiftlang/swift

[SR-14941] Introduce compiler warning for leading-zero octal notation

开放

#57,283 创建于 2021年7月19日

 (14 条评论) (0 个反应) (1 位负责人)Swift (10,719 个派生)batch import
good first issueimprovement

仓库指标

星标
 (69,989 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Previous ID SR-14941
Radar rdar://problem/22123688
Original Reporter eaigner (JIRA User)
Type Improvement
Votes 0
Component/s
Labels Improvement, StarterBug
Assignee None
Priority Medium

md5: 639a9bd96ac9c3918c5433098fa9ad29

Issue Description:

I had a bug in my code for quite some time that went by unnoticed, because I didn't realize Swift handled octal numbers differently. Specifically I was making the following call

mkfifo(path, 0644)

This should obviously read `0o644`, but went by unnoticed, since it just resulted in an elevated user permission.

It would be great if the compiler could warn in such instances where numbers are typed with leading zeroes, maybe something of the form "Did you mean to write an octal number?"

贡献者指南