Skip to content

[SR-3914] Invalid "Mixed-type subtraction is deprecated." warning Xcode 8.3 beta 2 #46499

@keith

Description

@keith
Previous ID SR-3914
Radar rdar://problem/30472072
Original Reporter @keith
Type Bug
Status Resolved
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, 3.1Regression, TypeChecker
Assignee None
Priority Medium

md5: 8ff5f9ec83e0c164daad3b038df2038b

Issue Description:

This code produces the "Mixed-type subtraction is deprecated." warning even though both `tv_usec` calls return a `_darwin_suseconds_t` aka `_int32_t` aka `Int32`

import Darwin

var bootTime: timeval = timeval()
var now: timeval = timeval()

_ = now.tv_usec - bootTime.tv_usec // Doesn't warn
_ = max(0, now.tv_usec - bootTime.tv_usec) // Doesn't warn
_ = UInt64(max(0, now.tv_usec - bootTime.tv_usec)) // Warns

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellatype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions