E119: Symbol Is Not a Value

This error is emitted when a package or Java-defined class is used in a position where a value is expected.

Packages and Java classes (without companion objects) cannot be used as values in Scala.


Example

val x = scala.collection

Error

-- [E119] Type Error: example.scala:1:14 ---------------------------------------
1 |val x = scala.collection
  |        ^^^^^^^^^^^^^^^^
  |        package scala.collection is not a value

Solution

// Use a specific value from the package
val x = scala.collection.immutable.List
// Or import and use a specific type
import scala.collection.mutable.ArrayBuffer
val x = ArrayBuffer[Int]()