If let idiom broken for first property of an empty array of a struct type

Consider this code:

import android.app
import android.content
import android.os
import android.util
import android.view
import android.widget


struct pairstuff{
    var a:String
	 var b:String
 }

    func testlet(_ arr:[pairstuff]){
		if let elt = arr.first{
    		println("1st:\(elt.a)")
		}
    }
    
    
    public class MainActivity: Activity {
    
    	public override func onCreate(_ savedInstanceState: Bundle!) {
    		super.onCreate(savedInstanceState)
    		ContentView = R.layout.main



			let empty = [pairstuff]()
			testlet(empty)
		}
    }

It gets compiled without errors and looks innocent enough, but it throws a null pointer exception at runtime.
Reason is, that the if let idiom doesn’t work as expected in this example.

Version info:
Microsoft Visual Studio 2015 Shell (Integrated)
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

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

Thanks, logged as bugs://77303

Can you try the beta? I must have fixed this a while ago as it doesn’t show in the latest version.

bugs://77303 got closed with status cannotrepro.

Sorry, I don’t have access to the beta.

Can you sign up for beta access here: https://secure.remobjects.com/portal/silver.aspx?

Thanks

I checked and yes, it seems to be fixed for the beta.

Interestingly, it now fails to build.
It would build the very first time,I tried after installation, but only that one time.
System restart Project clean up don’t seem to work.

It just says build failed, no Errors, no warnings:

------ Build started: Project: org.me.b5, Configuration: Debug ------
JDKRoot:C:\Program Files\Java\jdk1.8.0_121
JRERoot:C:\Program Files\Java\jre1.8.0_121
org.me.b5 -> E:\offen\dshDev\silver 9 bugs\org.me.b5\org.me.b5\bin\Debug\org.me.b5.jar
Done building project “org.me.b5.elements” – FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

It is even worse now: it won’t even build the unmodified android app template now, same behaviour.

version info:
Microsoft Visual Studio 2015 Shell (Integrated)
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

Installed Version: IDE Standard

RemObjects Elements 9.1.100.2111
RemObjects Elements (Oxygene, C# and Silver) for .NET, Cocoa, Java and Island.
Copyright 2003-2017 RemObjects Software, LLC. All rights reserved.
http://www.remobjects.com/elements

RemObjects Elements leverages the LLVM compiler backend:
Copyright © 2003-2017 University of Illinois at Urbana-Champaign. All rights reserved.
http://llvm.org

RemObjects Everwood 4.7.80.709
RemObjects Everwood
Copyright RemObjects Software, LLC 2002-2017. All Rights Reserved.
http://www.remobjects.com/everwood

Can you turn on details build logs and post the log?

How do i do that?

Apart from that, I found out, this happens, when using silver together with the Android sdk version that comes with “android-studio-bundle-162.3764568-windows.exe”, but
android-studio-bundle-145.3537739-windows.exe is ok.

Found the setting, logs attached: The closing error message was in german for some reason…
I added the translation…
buildlogdetailed.txt (77.7 KB)

Same issue as in a couple of the other threads — this is something Android version 25 /ADS 2.3 broke, and should be fixed for last friday’s beta.

FWIW, please don’t recycle old threads for new bugs, it’ll cause the reports to get overlooked, like tgis one did

Logged as bugs://i65034.

bugs://i65034 was closed as unable to reproduce.