summaryrefslogblamecommitdiff
path: root/test/files/run/repl-parens.check
blob: 4b7ce6b059afce8bb76089ee9c21ba590a9e13b7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                           









                                   





                                                                                                                     

             
                             
                        

                                
                               
 
                                                                            
                   



                                 





                                                                                                                     
                                
 
                                           


                                                                                                                     

                              
       

              
                              

                   


                                                                                                                     
                              

                                
                                 






                                              
               

       




                                
Type in expressions to have them evaluated.
Type :help for more information.

scala> (2)
res0: Int = 2

scala> (2 + 2)
res1: Int = 4

scala> ((2 + 2))
res2: Int = 4

scala>   ((2 + 2))
res3: Int = 4

scala>   (  (2 + 2))
res4: Int = 4

scala>   (  (2 + 2 )  )
res5: Int = 4

scala> 5 ;   (  (2 + 2 )  ) ; ((5))
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
              5 ;   (  (2 + 2 )  ) ;;
              ^
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
              5 ;   (  (2 + 2 )  ) ;;
                          ^
res6: Int = 5

scala> (((2 + 2)), ((2 + 2)))
res7: (Int, Int) = (4,4)

scala> (((2 + 2)), ((2 + 2)), 2)
res8: (Int, Int, Int) = (4,4,2)

scala> (((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString)
res9: String = 4423

scala> 

scala> 55 ; ((2 + 2)) ; (1, 2, 3)
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
              55 ; ((2 + 2)) ;;
              ^
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
              55 ; ((2 + 2)) ;;
                       ^
res10: (Int, Int, Int) = (1,2,3)

scala> 55 ; (x: Int) => x + 1 ; () => ((5))
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
              55 ; (x: Int) => x + 1 ;;
              ^
res11: () => Int = <function0>

scala> 

scala> () => 5
res12: () => Int = <function0>

scala> 55 ; () => 5
<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
              55 ;;
              ^
res13: () => Int = <function0>

scala> () => { class X ; new X }
res14: () => Object = <function0>

scala> 

scala> def foo(x: Int)(y: Int)(z: Int) = x+y+z
foo: (x: Int)(y: Int)(z: Int)Int

scala> foo(5)(10)(15)+foo(5)(10)(15)
res15: Int = 60

scala> 

scala> List(1) ++ List('a')
res16: List[AnyVal] = List(1, a)

scala>