Skip to content

fix problems that prevent implementing import shadowing protection#3989

Merged
kyllingstad merged 1 commit intodlang:masterfrom
WalterBright:zipprocess
Feb 12, 2016
Merged

fix problems that prevent implementing import shadowing protection#3989
kyllingstad merged 1 commit intodlang:masterfrom
WalterBright:zipprocess

Conversation

@WalterBright
Copy link
Member

Changing the language so that local imports no longer 'shadow' other symbols revealed some problems in Phobos, which this addresses.

import std.bitmanip : littleEndianToNative, nativeToLittleEndian;
import std.algorithm : max;
import std.conv : to;
import std.zlib : compress;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The later use of std.zlib.compress() relies on a bug in dmd that messed up the scope list so that std was found. Import binds are supposed to prevent inserting the module package into the symbol table.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But std is definitely available here by some of the non-selective imports.

@WalterBright WalterBright force-pushed the zipprocess branch 2 times, most recently from addc600 to cf17637 Compare February 12, 2016 05:19
{
import core.sys.posix.signal;
import core.sys.posix.signal : kill;
if (kill(pid.osHandle, codeOrSignal) == -1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code relied on import core.sys.posix.signal; hiding the upscope kill().

@kyllingstad
Copy link
Contributor

Auto-merge toggled on

@WalterBright
Copy link
Member Author

I had to amend ssa_SSSE3.d, too, since it has the same problem.

kyllingstad added a commit that referenced this pull request Feb 12, 2016
fix problems that prevent implementing import shadowing protection
@kyllingstad kyllingstad merged commit 50e3fc6 into dlang:master Feb 12, 2016
@WalterBright WalterBright deleted the zipprocess branch February 12, 2016 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants