|
Revision 3550, 1.3 KB
(checked in by sukyoungryu, 9 months ago)
|
|
[copyright] Fixed the copyright notices.
|
| Line | |
|---|
| 1 | (******************************************************************************* |
|---|
| 2 | Copyright 2009 Sun Microsystems, Inc., |
|---|
| 3 | 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 | All rights reserved. |
|---|
| 5 | |
|---|
| 6 | U.S. Government Rights - Commercial software. |
|---|
| 7 | Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 | license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 | |
|---|
| 10 | Use is subject to license terms. |
|---|
| 11 | |
|---|
| 12 | This distribution may include materials developed by third parties. |
|---|
| 13 | |
|---|
| 14 | Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 | trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 | ******************************************************************************) |
|---|
| 17 | component desugarBug0 |
|---|
| 18 | import Set.{...} |
|---|
| 19 | export Executable |
|---|
| 20 | |
|---|
| 21 | (* There is a bug in the desugaring of "n x" that |
|---|
| 22 | causes it to not be recognized as a method invocation. |
|---|
| 23 | "n" is invoked as a function, using the wrong environment, |
|---|
| 24 | and subsequently fails to find "=" . *) |
|---|
| 25 | |
|---|
| 26 | trait Foo |
|---|
| 27 | m(x: ZZ32): ZZ32 = x^2 + n x |
|---|
| 28 | n(x: ZZ32): ZZ32 = do |
|---|
| 29 | if x = 0 then x |
|---|
| 30 | else x + 1 end |
|---|
| 31 | end |
|---|
| 32 | end |
|---|
| 33 | |
|---|
| 34 | object O extends Foo |
|---|
| 35 | x: ZZ64 = m(1) |
|---|
| 36 | end |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | run():() = do |
|---|
| 40 | z = {x^2 | x <- {i | i <- 0#100}} |
|---|
| 41 | for i <- sequential(z) do |
|---|
| 42 | println(2 + O.x i) |
|---|
| 43 | end |
|---|
| 44 | end |
|---|
| 45 | end |
|---|