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

Scala example source code file (structural.check)

This example Scala source code file (structural.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

a, b, c, d, d, null, null, object, object, parameter, parameter, t, u, unit

The Scala structural.check source code

structural.scala:47: error: Parameter type in structural refinement may not refer to the type of that refinement (self type)
  val s1 = new { def f(p: this.type): Unit = () }
                     ^
structural.scala:19: error: illegal dependent method type
    def f9[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): D }) = x.m[Tata](null) //fail
                        ^
structural.scala:10: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
    def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail
                                                         ^
structural.scala:11: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
    def f2[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: B): Object; val x: B }) = x.m[Tata](x.x) //fail
                                                         ^
structural.scala:12: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
    def f3[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: C): Object; val x: C }) = x.m[Tata](x.x) //fail
                                                         ^
structural.scala:13: error: Parameter type in structural refinement may not refer to a type member of that refinement
    def f4[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: D): Object; val x: D }) = x.m[Tata](x.x) //fail
                                                         ^
structural.scala:42: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
  type Summable[T] = { def +(v : T) : T }
                           ^
structural.scala:46: error: Parameter type in structural refinement may not refer to the type of that refinement (self type)
  type S1 = { def f(p: this.type): Unit }
                  ^
structural.scala:49: error: Parameter type in structural refinement may not refer to a type member of that refinement
  type S2 = { type T; def f(p: T): Unit }
                          ^
structural.scala:52: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement
  def s3[U >: Null <: Object](p: { def f(p: U): Unit; def u: U }) = ()
                                       ^
10 errors found

Other Scala examples (source code examples)

Here is a short list of links related to this Scala structural.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.