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

Scala example source code file (clsrefine.scala)

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

a, any, b, int, int, string, unit, x1, x1, x2, x2, y, y

The Scala clsrefine.scala source code

import scala._;

package scalac.util {

trait A {
  type X1;
  type X2;
  val x1: X1;
  val x2: X2;
}
trait B extends A {
  type Y;
  val y1, y2: Y;
  type X1 = Y;
  type X2 = Y;
  val x1 = y1;
  val x2 = y2;
  def f(x: Y, xs: B): Unit = {}
  def g() = f(y1, this);
}

object test {
  val b: B { type Y = Int } = new B {
    type Y = Int;
    val y1, y2 = 1;
  }
  val a: A { type X1 = Int; type X2 = Int } = b;
  val a1 = new A { 
    type X1 = Int;
    type X2 = String; 
    val x1 = 1;
    val x2 = "hello"
  }
  val b1 = new B {
    type Y = Any;
    val y1 = 1;
    val y2 = "hello";
  }
}
}

Other Scala examples (source code examples)

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