Bug 9413 – Incorrect modification inside contracts is not detected correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-27T23:46:00Z
Last change time
2013-04-03T01:31:55Z
Keywords
accepts-invalid, diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-01-27T23:46:20Z
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.
Comment #1 by k.hara.pg — 2013-01-28T04:01:40Z
Comment #2 by github-bugzilla — 2013-04-03T01:19:57Z
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