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

Scala example source code file (patmat-type-check.check)

This example Scala source code file (patmat-type-check.check) 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

array, array, bop2, bop2, bop3, bop3, seq, seq

The Scala patmat-type-check.check source code

patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type;
 found   : Seq[A]
 required: java.lang.String
  def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail
                                         ^
patmat-type-check.scala:23: error: scrutinee is incompatible with pattern type;
 found   : Seq[A]
 required: Array[Char]
  def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail
                                         ^
patmat-type-check.scala:27: error: scrutinee is incompatible with pattern type;
 found   : Seq[A]
 required: Test.Bop2
  def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail
                                      ^
patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type;
 found   : Seq[A]
 required: Test.Bop3[Char]
  def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail
                                               ^
four errors found

Other Scala examples (source code examples)

Here is a short list of links related to this Scala patmat-type-check.check source code file:

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 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.