Bug 15811 – -transition=import and -transition=checkimport have oddly behaviors

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-19T06:48:00Z
Last change time
2016-03-19T18:29:08Z
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2016-03-19T06:48:59Z
From the dmd help message: $ dmd -transition=? DMD v2.070 DEBUG Language changes listed by -transition=id: =all list information on all language changes =checkimports give deprecation messages about 10378 anomalies =complex,14488 list all usages of complex or imaginary types =field,3449 list all non-mutable fields which occupy an object instance =import,10378 revert to single phase name lookup =tls list all variables going into thread local storage When I tested the combination with -transition=import and -transition=checkimport switches, I get some oddly behaviors. 1) dmd test.d Use new lookup algorithm without any information messages. It's intentional because Walter hates compilation slow down to show messaged for old behavior. 2) dmd -transition=import test.d Use old lookup algorithm without any information messages. Not bad. 3) dmd -transition=import -transition=checkimports test.d Use old lookup algorithm with informative deprecation messages. not bad. 4) dmd -transition=checkimports test.d Use OLD lookup algorithm with informative deprecation messages. Why we cannot use the new algorithm with information? It's inconvenient for code upgrade path. The reason is that `-transison=checkimports` will silently enables the old lookup algorithm. Honestly I couldn't gess it from the command line help message. And, the two switches are order-dependent. 5a) dmd -transition=import -transition=checkimports test.d -transition=import is overwritten by -transition=checkimports. Current -transition=checkimports silently chooses old lookup rule, so it's looked like being working as expected. 5b) dmd -transition=checkimports -transition=import test.d -transition=checkimports is overwritten by -transition=import. The information messages is killed by -transition=import, so it's very confusing. I think this is a blocker issue for the next 2.071.0 major release.
Comment #1 by k.hara.pg — 2016-03-19T07:20:16Z
Note: I've used following test case. void foo(string text) { import std.conv; auto s = text; assert(s == "a"); } void main() { foo("a"); } If assert succeeds, new lookup rule is used. Otherwise old lookup rule is used.
Comment #2 by github-bugzilla — 2016-03-19T18:29:07Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/068397777592f75418dac14c4c7b8e2d2e184bf3 fix Issue 15811 - -transition=import and -transition=checkimport have oddly behaviors https://github.com/D-Programming-Language/dmd/commit/3c8c2d86f75a142e2ae442d997e8d84815235430 Merge pull request #5543 from 9rnsr/fix15811 Issue 15811 - -transition=import and -transition=checkimport have oddly behaviors