www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9398] New: strange error message "incompatible types for ..." for temary operator

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398

           Summary: strange error message "incompatible types for ..." for
                    temary operator
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kekeniro2 yahoo.co.jp


--- Comment #0 from kekeniro2 yahoo.co.jp 2013-01-25 21:47:12 PST ---
Error message showing type mismatch for 
 (a ? b : c)
is printed below:
 Error: incompatible types for ((b) ? (c)): 'B' and 'C'

Wrong '?' position.

It shoud be ... ((a) ? (b) : (c)): 'B' and 'C'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich gmail.com
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-26
12:57:32 PST ---
https://github.com/D-Programming-Language/dmd/pull/1555

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|strange error message       |Wrong diagnostic for
                   |"incompatible types for     |ternary operator type
                   |..." for temary operator    |mismatch


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-26
13:00:58 PST ---
(In reply to comment #0)
 It should be ... ((a) ? (b) : (c)): 'B' and 'C'

Nope, it should be:
 ((b) : (c)): 'B' and 'C'

Otherwise you can't determine what position 'B' and 'C' are in because the ternary expression could be quite complex, e.g.:
 ((a) ? (a) : (b) ? (b) : (c)): 'int' and 'float'

-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398



--- Comment #3 from github-bugzilla puremagic.com 2013-01-26 14:50:09 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bba09e60fa4cbb59c84fc125d4ca58a4eb231578
Fixes Issue 9398 - Print colon instead of question mark for mismatch of ternary
operator types.

https://github.com/D-Programming-Language/dmd/commit/57a0ea9bd6035b12603ed9e99f67f7c5b7b00679
Merge pull request #1555 from AndrejMitrovic/Fix9398

Issue 9398 - Print colon for mismatch of ternary operator types

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2013