www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9413] New: Incorrect modification inside contracts is not detected correctly

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

           Summary: Incorrect modification inside contracts is not
                    detected correctly
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-01-27 23:46:20 PST ---
L7 and L17 should cause errors, but doesn't.

int foo(int x)
in
{
    int a;
    int bar(int y)
    {
        x = 10; // L7
        return 2;
    }
    x = 10;     // L10 err, OK
}
out(r)
{
    int a;
    int baz(int y)
    {
        x = 10; // L17
        return 2;
    }
    x = 10;     // L20
}
body
{
    return 1;
}

output:
test.d(10): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(10): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(20): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(20): Error: variable test.foo.x cannot modify parameter 'x' in contract

And, there is also duplicated error message issue.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-01-28 04:01:40 PST ---
https://github.com/D-Programming-Language/dmd/pull/1569

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



--- Comment #2 from github-bugzilla puremagic.com 2013-04-03 01:19:57 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bb7c2f1e5cf6d8d9f254007bf125b20c7825581d
fix Issue 9413 - Incorrect modification inside contracts is not detected
correctly

https://github.com/D-Programming-Language/dmd/commit/80de2b74d847fe38102cd32c69ffbbfacaaaf3a8
Merge pull request #1569 from 9rnsr/fix_contracts

Issue 9413 & 9414 - Detect incorrect modification inside contracts

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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