E07900: Invalid value

Category: E07xxx Full resolution · Reported in phase: SYMBOL_DEFINITION · Classification: INVALID_VALUE · All error codes

What went wrong

The value provided is not valid for this context.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 113 (How does the text construct work for internationalization?)

How to fix it

  1. Provide valid value for context
  2. Check expected type and constraints

Common causes

  • Value outside valid range
  • Type mismatch
  • Invalid literal

See also

  • E07900: invalid value (this error)
  • E07560: positive Integer required

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E07900: Invalid value

#!ek9
defines module error.e07900.bad

  //Invalid: uppercase base (should be lowercase)
  defines text for "EN"

    TestText1
      welcome()
        "Welcome"

  //Invalid: uppercase base with country code
  defines text for "EN_US"

    TestText2
      greeting()
        "Hello"

  //Invalid: hyphen instead of underscore
  defines text for "en-US"

    TestText3
      message()
        "Hi there"

  //Invalid: lowercase country code
  defines text for "en_us"

    TestText4
      welcome()
        "Welcome"

Fixed: Use the language_COUNTRY form

#!ek9
defines module error.e07900.good

  //A language code is lowercase; a country code, after '_', is uppercase
  defines text for "en"

    WelcomeText
      welcome()
        "Welcome"

  defines text for "en_US"

    WelcomeText
      welcome()
        "Hi there"

  defines text for "en_GB"

    WelcomeText
      welcome()
        "Hello"

Questions and answers

These Q&A entries show E07900 and its fix: