aboutsummaryrefslogblamecommitdiff
path: root/tests/repl/errmsgs.check
blob: d8c1b9215e74dc04dcf6faf375f3bd240ffdb50b (plain) (tree)
1
2
3
4
5
6
7
8
9


                                    





                                                                                
                                                





                                                                                
                                                              











                                                                                
                                               







                                                                                
                                      





                                                                                














                             












                                                                                

              


                                                                             
            
scala> class Inv[T](x: T)
defined class Inv
scala> val x: List[String] = List(1)
-- Error: <console> ------------------------------------------------------------
3:val x: List[String] = List(1)
                             ^
                             type mismatch:
                             found:    Int(1)
                             required: String
scala> val y: List[List[String]] = List(List(1))
-- Error: <console> ------------------------------------------------------------
3:val y: List[List[String]] = List(List(1))
                                        ^
                                        type mismatch:
                                        found:    Int(1)
                                        required: String
scala> val z: (List[String], List[Int]) = (List(1), List("a"))
-- Error: <console> ------------------------------------------------------------
3:val z: (List[String], List[Int]) = (List(1), List("a"))
                                           ^
                                           type mismatch:
                                           found:    Int(1)
                                           required: String
-- Error: <console> ------------------------------------------------------------
3:val z: (List[String], List[Int]) = (List(1), List("a"))
                                                    ^
                                                    type mismatch:
                                                    found:    String("a")
                                                    required: Int
scala> val a: Inv[String] = new Inv(new Inv(1))
-- Error: <console> ------------------------------------------------------------
4:val a: Inv[String] = new Inv(new Inv(1))
                                   ^^^^
                        type mismatch:
                        found:    Inv[T]
                        required: String
                        
                        where  T  is a type variable with constraint >: Int(1)
scala> val b: Inv[String] = new Inv(1)
-- Error: <console> ------------------------------------------------------------
4:val b: Inv[String] = new Inv(1)
                               ^
                               type mismatch:
                               found:    Int(1)
                               required: String
scala> abstract class C {
           type T
           val x: T
           val s: Unit = {
             type T = String
             var y: T = x
             locally {
               def f() = {
                 type T = Int
                 val z: T = y
               }
               f()
             }
           }
         }
-- Error: <console> ------------------------------------------------------------
8:      var y: T = x
                   ^
 type mismatch:
 found:    C.this.T(C.this.x)
 required: T'
 
 where  T   is a type in class C
        T'  is a type in the initalizer of value s which is an alias of String
-- Error: <console> ------------------------------------------------------------
12:          val z: T = y
                        ^
type mismatch:
found:    T(y)
required: T'

where  T   is a type in the initalizer of value s which is an alias of String
       T'  is a type in method f which is an alias of Int
scala> :quit