I made a testproject in Visual Studio, which essentially contained the following functions:
func testarray(){
let array = [2,2,1,1,3]
var sum = 0
for i in array{
sum += i
}
let st:Iterable
st = array
let count:Int = countthrough(c: st)//,dummy: Int(0))
assert(sum == 9,"array works")
assert(count == array.count && count == 5)
}
func countthrough(c:Iterable)->Int{
var ret = 0
for elt in c{
ret += 1
}
return ret
}
If i try to compile these functions, i get
an internal error at the line where countthrough gets called:
Error (E0) Internal error: Object reference not set to an instance of an object.
If i perform the call like this:
let count:Int = countthrough(c: array)
it works.
Version info:
Microsoft Visual Studio 2015 Shell (Integrated)
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.01590
Installed Version: IDE Standard
RemObjects Elements 9.0.97.2071
RemObjects Elements (Oxygene, C# and Silver) for .NET, Cocoa and Java.
Copyright 2003-2016 RemObjects Software, LLC. All rights reserved.
http://www.remobjects.com/elements
RemObjects Elements leverages the LLVM compiler backend:
Copyright © 2003-2016 University of Illinois at Urbana-Champaign. All rights reserved.
http://llvm.org
RemObjects Everwood 4.7.79.695
RemObjects Everwood
Copyright RemObjects Software, LLC 2002-2016. All Rights Reserved.
http://www.remobjects.com/everwood