| 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 | |
|---|
| 18 | component genericFunctionalMethods |
|---|
| 19 | export Executable |
|---|
| 20 | |
|---|
| 21 | (** Initialization of generic functional methods in the interpreter is |
|---|
| 22 | failing, signaling that the generic parameter is unbound. |
|---|
| 23 | Commenting out the declaration and use of bar allows execution of |
|---|
| 24 | the equivalent dotted method to succeed. **) |
|---|
| 25 | object O |
|---|
| 26 | foo[\T\](x:T): T = x |
|---|
| 27 | (* |
|---|
| 28 | bar[\T\](self, y:T): T = y |
|---|
| 29 | *) |
|---|
| 30 | end |
|---|
| 31 | |
|---|
| 32 | run():() = do |
|---|
| 33 | assert(O.foo[\ZZ32\](17),17) |
|---|
| 34 | assert(bar[\ZZ32\](O,17),17) |
|---|
| 35 | println("OK") |
|---|
| 36 | end |
|---|
| 37 | |
|---|
| 38 | end |
|---|