alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (bug3683b.scala)

This example Scala source code file (bug3683b.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

bar, bar, foo, foo, int, main, w, w, x, x, xx, y, z

The Scala bug3683b.scala source code

sealed trait Foo
sealed trait Bar extends Foo
sealed trait W[T >: Bar <: Foo]
case class X() extends W[Foo]
case class XX() extends W[Bar]
case class Y() extends W[Bar]
case class Z[T >: Bar <: Foo](
  z1: W[T]
) extends W[T]

object Main {  
  // should fail for including X()
  def f1(w: W[Bar]): Int = {
    w match {
      case X() => 1
      case XX() => 2
      case Y() => 1
      case Z(z) => f1(z)
    }
  }
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala bug3683b.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.