Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-119437

Drop optional when nullish coalescing an optional T with a rhs of type T

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • 6.10
    • 6.7
    • QML: Compiler
    • None
    • 2b336217b (dev)

    Description

      It should be possible to do this:

      property int i: (Anything as int) ?? 1 

      In both cases an int is returned and the optional can be dropped. 

       

      This does currently not work because of 

       (strict mode) Cannot assign potential undefined to int ... 

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtqmlteam Qt Qml Team User
              olivier.decanniere Olivier De Cannière
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes