Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtend2 array conversion
Xtend2 array conversion [message #737167] Fri, 14 October 2011 18:35 Go to next message
Jason Barkanic is currently offline Jason BarkanicFriend
Messages: 16
Registered: November 2009
Junior Member
If I write:

var a = 'a,b,c'.split(',')
a = a.tail


it validates and compiles, but I get a runtime error on the second line.

Is this working as intended in the Xtend2 type system, or a bug?

There seems to be 'something' wrong with the situation, because it seems impossible to determine the expected conversion behavior outside of trial-and-error and/or inspecting the internals of functions you will be calling.

In this case the call to IterableExtensions.tail wraps the already wrapped array, so it doesn't know how to unwrap it afterward.

String[] _split = "a,b,c".split(",");
String[] a = _split;
final String[] typeConverted_a = (String[])a;
Iterable<String> _tail = IterableExtensions.<String>tail(((Iterable<String>)Conversions.doWrapArray(typeConverted_a)));
a = ((String[])Conversions.unwrapArray(_tail));
Re: Xtend2 array conversion [message #737234 is a reply to message #737167] Fri, 14 October 2011 20:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

can you please file a bug for this.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtend2 array conversion [message #737863 is a reply to message #737167] Sat, 15 October 2011 14:55 Go to previous message
Jason Barkanic is currently offline Jason BarkanicFriend
Messages: 16
Registered: November 2009
Junior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=361061
Previous Topic:replace references
Next Topic:xtext user-extended components dependencies
Goto Forum:
  


Current Time: Mon Sep 23 02:40:51 GMT 2024

Powered by FUDForum. Page generated in 0.04696 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top