Swift compiler should warn about unnecessary casts

Originator:fluidsonic
Number:rdar://21669528 Date Originated:2015-07-03
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 Beta 2
Classification:Enhancement Reproducible:Always
 
Summary:
The following code has an unnecessary cast from [UIView] to [UIView] which should cause a compiler warning:

import UIKit

func test(view: UIView) {
	for _ in view.subviews as [UIView] {
		// ...
	}
}

Steps to Reproduce:
1. Place the code from the description into a playground.


Expected Results:
The unnecessary cast in line 4 should cause a warning.

Actual Results:
The unnecessary cast in line 4 does not cause a warning.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!