Skip to content

Commit

Permalink
Test for #1917
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Nov 18, 2014
1 parent ab64e6c commit fdd2991
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -890,4 +890,9 @@ public void testBug1914() {
public void testBug1916() {
compareWithJavaSource("bug19xx/Bug1916");
}

@Test
public void testBug1917() {
compareWithJavaSource("bug19xx/Bug1917");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the authors tag. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License version 2.
*
* This particular file is subject to the "Classpath" exception as provided in the
* LICENSE file that accompanied this code.
*
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License,
* along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
@noanno
void bug1917(){
variable Object a;
Integer b = a = 2;
a = 2;
}

@noanno
void bug1917fails<Result>(Result() f) {
variable Anything memo;
Result x = memo = f();
}

@noanno
void bug1917works<Result>(Result() f) {
variable Result|Object|Null memo;
Result x = memo = f();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.redhat.ceylon.compiler.java.test.issues.bug19xx;

final class bug1917_ {

private bug1917_() {
}

static void bug1917() {
.java.lang.Object a = null;
final long b = (
let
{
.ceylon.language.Integer $ceylontmp$op$0 = .ceylon.language.Integer.instance(2L);
a = $ceylontmp$op$0;
}
returning $ceylontmp$op$0;
).longValue();
a = .ceylon.language.Integer.instance(2L);
}

public static void main(.java.lang.String[] args) {
.ceylon.language.process_.get_().setupArguments(args);
.com.redhat.ceylon.compiler.java.test.issues.bug19xx.bug1917_.bug1917();
}
}
final class bug1917fails_ {

private bug1917fails_() {
}

static <Result>void bug1917fails(final .com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor $reified$Result, final .ceylon.language.Callable<? extends Result> f) {
.java.lang.Object memo = null;
final Result x = (
let
{
Result $ceylontmp$op$1 = f.$call$();
memo = $ceylontmp$op$1;
}
returning $ceylontmp$op$1;
);
}
}
final class bug1917works_ {

private bug1917works_() {
}

static <Result>void bug1917works(final .com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor $reified$Result, final .ceylon.language.Callable<? extends Result> f) {
.java.lang.Object memo = null;
final Result x = (Result)(
let
{
Result $ceylontmp$op$2 = f.$call$();
memo = $ceylontmp$op$2;
}
returning $ceylontmp$op$2;
);
}
}

0 comments on commit fdd2991

Please sign in to comment.