E015: 중복 수정자

E015: 중복 수정자 (Repeated Modifier)

이 에러는 정의(definition)에 같은 수정자(modifier)가 두 번 이상 지정될 때 발생해요. 각 수정자는 한 번만 나타나야 해요.

출처: Scala 3 Reference

본문

Example

private private val x = 1

Error

-- [E015] Syntax Error: example.scala:1:8 --------------------------------------
1 |private private val x = 1
  |        ^^^^^^^
  |        Repeated modifier private
  |-----------------------------------------------------------------------------
  | Explanation (enabled by `-explain`)
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  | This happens when you accidentally specify the same modifier twice.
  |
  | Example:
  |
  | private private val Origin = Point(0, 0)
  |
  | instead of
  |
  | private final val Origin = Point(0, 0)
   -----------------------------------------------------------------------------

Solution

// Remove the duplicate modifier
private val x = 1
// If you meant to use different modifiers, use the correct combination
private final val x = 1

더 알아보기

  • 정의에 쓸 수 있는 수정자 목록은 "Definitions / Modifiers" 관련 문서를 참고하세요.