Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • shchen/cs320
  • raveendr/cs320
  • mwojnaro/cs320
3 results
Show changes
Showing
with 105 additions and 0 deletions
object LogicalError
() && true
end LogicalError
object LogicalError
!()
end LogicalError
object MatchError
1 match { case true => () }
end MatchError
object MatchError
val x: Int(32) = 1 match { case 2 => "" }; x
end MatchError
object MatchError
1 match {
case 1 => ()
case 2 => ""
}
end MatchError
object MatchError
abstract class Foo
case class Bar(i: Int(32)) extends Foo
Bar(1) match {
case true => ()
}
end MatchError
object MatchError
abstract class Foo
case class Bar(i: Int(32)) extends Foo
Bar(1) match {
case Bar(true) => ()
}
end MatchError
object MatchError
abstract class Foo
case class Bar(i: Int(32)) extends Foo
abstract class Foo2
case class Bar2(i: Int(32)) extends Foo2
Bar(1) match {
case Bar2(1) => ()
}
end MatchError
object OperatorError
val str: String = 1 + 1;
str
end OperatorError
object OperatorError
val str: String = 1 + 1;
str
end OperatorError
object OperatorError
val str: String = !true;
str
end OperatorError
object SeqError
1 + true; false
end SeqError
object SeqError
val x: Boolean = 1; 2; x
end SeqError
object SeqError
val x: Boolean = (true; 2);
0
end SeqError
object Arithmetic
1 + 2 * 3 / 4 % -5
end Arithmetic
object Comparison
val b1: Boolean = 1 <= 2;
val b2: Boolean = 2 < 3;
val c1: Boolean = b1 && b2;
val c2: Boolean = b1 || b2;
c1 == !c2
end Comparison
object Constructors
abstract class Foo
case class Bar(i: Int(32)) extends Foo
case class Baz(b: Boolean, f: Foo) extends Foo
abstract class Foo2
case class Bar2(i: Int(32)) extends Foo2
case class Baz2(b: Boolean, f: Foo2) extends Foo2
Baz(true, Baz(false, Bar(42)));
Baz2(true, Baz2(false, Bar2(42)))
end Constructors
object Error
def test(): Unit = {
error("") // Stub implementation
}
test()
end Error
\ No newline at end of file
object FunctionCalls
def foo(i: Int(32), j: Boolean): String = {
if(j) { i < 0 || j; "Hello" } else {foo(i-1, !j)}
}
end FunctionCalls
object If
if (true) { 1 } else { 2 };
if (true) { "" } else { error("") };
val x: Int(32) = if (true) { 1 } else { 2 };
x
end If