Skip to content

[SR-6928] Bad error message when mixing operators #49476

@swift-ci

Description

@swift-ci
Previous ID SR-6928
Radar rdar://problem/37290901
Original Reporter jlongster (JIRA User)
Type Bug
Environment

NA

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

md5: 78ea10ca49c4c971a8f1e189eeacd02a

Issue Description:

Here is a simple repro: https://gist.github.com/jlongster/a1b9405ce4ee9360254cbfb35e8b7013

Running that code gives an error: "Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions"

The real error should be `Binary operator '*' cannot be applied to operands of type 'Int' and 'Double'`, and the fix is using `Double(index)` instead of just `index`. The above error message is strange given that it's not that complex of an expression.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysis

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions