function f(){ var a=1; with({ get a() { return false } }) return a }; f() throws TypeError with optimistic compilation

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 9
    • Component/s: core-libs
    • None
    • b22
    • generic
    • generic

        jjs -J-Djava.ext.dirs=$jdk9-dev/nashorn/dist

        jjs> function f(){var a=1; with({get a(){return false}}) return a}; f()
        <shell>:1 TypeError: Cannot set property "a" of [object Object] that has only a getter

        With optimistic types switched off, evaluates to (expected) false value.

        jjs -J-Djava.ext.dirs=$jdk9-dev/nashorn/dist --optimistic-types=false
        jjs> function f(){var a=1; with({get a(){return false}}) return a}; f()
        false


              Assignee:
              Attila Szegedi
              Reporter:
              Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: