Xcode-7-beta (7A120f): [Swift] Constructing a finite tree recurses infinitely

Originator:segiddins
Number:rdar://21435263 Date Originated:17-Jun-2015 08:44 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-7-beta (7A120f)
Classification:UI/Usability Reproducible:Always
 
Summary:
Some code should halt (even though I can’t prove it). It doesn’t.

Steps to Reproduce:
Run the following swift code:
final class Box<T> {
	let unbox: T
	init(_ x: T) { unbox = x }
}

enum Tree<T> {
	case Empty
	case Leaf(T)
	case Node(Box<Tree<T>>, Box<Tree<T>>)
}

let l = Tree.Leaf("hi")
let r = Tree.Leaf("there")

let tree = Tree.Node(Box(l), Box(r))
print(tree)


Expected Results:
The program should print out the tree

Actual Results:
The program never halts

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!