fork download
  1. object Main extends App {
  2. type L1[A] = scala.collection.immutable.List[A]
  3. type L2[+A] = scala.collection.immutable.List[A]
  4.  
  5.  
  6. val a: L1[String] = List("apple", "orange", "melon")
  7. val b: L1[CharSequence] = a // 定義可能です
  8.  
  9.  
  10. val c: L2[String] = List("apple", "orange", "melon")
  11. val d: L2[CharSequence] = c // 定義可能です
  12.  
  13. println("実行もOK")
  14. }
Success #stdin #stdout 0.36s 4382720KB
stdin
Standard input is empty
stdout
実行もOK