Skip to content

Redundant errors in synthesized makeIterator call on conflicting generic arguments in for-in sequence expression #72818

Open
@AnthonyLatsis

Description

@AnthonyLatsis

Description

No response

Reproduction

func foo<T>(_: T, _: T) -> [T] {}

func test() {
  let int: Int
  let int16: Int16
  for _ in foo(int16, int) {}
}
error: conflicting arguments to generic parameter 'Self' ('[Int16]' vs. '[Int]') [conflicting_arguments_for_generic_parameter]
  for _ in foo(int16, int) {}
                         ^
error: conflicting arguments to generic parameter 'T' ('Int16' vs. 'Int') [conflicting_arguments_for_generic_parameter]
  for _ in foo(int16, int) {}
           ^
error: conflicting arguments to generic parameter 'Elements' ('[Int16]' vs. '[Int]') [conflicting_arguments_for_generic_parameter]
  for _ in foo(int16, int) {}
  ^

Expected behavior

A single error in relation to written code: conflicting arguments to generic parameter 'T' ('Int16' vs. 'Int').

Environment

Swift version 6.0-dev (LLVM 48dc0c6fa01ce9e, Swift 2650c285671c227)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementationfor-in loopsFeature: for-in loopsgenericsFeature: generic declarations and typesstatementsFeature: statementsswift 6.0type checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions