-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/src/com/redhat/ceylon/compiler/java/test/issues/bug19xx/Bug1917.ceylon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
59 changes: 59 additions & 0 deletions
59
test/src/com/redhat/ceylon/compiler/java/test/issues/bug19xx/Bug1917.src
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
); | ||
} | ||
} |