File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
src/compiler/scala/tools/nsc/interpreter Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ trait MemberHandlers {
120
120
private def vparamss = member.vparamss
121
121
private def isMacro = member.mods.hasFlag(scala.reflect.internal.Flags .MACRO )
122
122
// true if not a macro and 0-arity
123
- override def definesValue = ! isMacro && (vparamss.isEmpty || vparamss.head.isEmpty)
123
+ override def definesValue = ! isMacro && (vparamss.isEmpty || vparamss.head.isEmpty && vparamss.tail.isEmpty )
124
124
override def resultExtractionCode (req : Request ) =
125
125
if (mods.isPublic) codegenln(name, " : " , req.typeOf(name)) else " "
126
126
}
Original file line number Diff line number Diff line change
1
+ Type in expressions to have them evaluated.
2
+ Type :help for more information.
3
+
4
+ scala>
5
+
6
+ scala> def h()(i: Int) = 1 + i
7
+ h: ()(i: Int)Int
8
+
9
+ scala> println(h()(5))
10
+ 6
11
+
12
+ scala> val f = h() _
13
+ f: Int => Int = <function1>
14
+
15
+ scala> println(f(10))
16
+ 11
17
+
18
+ scala>
19
+
20
+ scala>
Original file line number Diff line number Diff line change
1
+ import scala .tools .partest .ReplTest
2
+
3
+ object Test extends ReplTest {
4
+ def code = """
5
+ def h()(i: Int) = 1 + i
6
+ println(h()(5))
7
+ val f = h() _
8
+ println(f(10))
9
+ """
10
+ }
You can’t perform that action at this time.
0 commit comments