[Issue 16974] Equal associative arrays with associative array keys are considered unequal

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16974

safety0ff.bugz  changed:

   What|Removed |Added

 CC||safety0ff.b...@gmail.com

--- Comment #2 from safety0ff.bugz  ---
You've marked this as a regression, which version did this previously work in?

--


[Issue 16973] `hashOf` has error-prone signature as `(T, seed)` may be confused with `(ptr, length)`

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16973

safety0ff.bugz  changed:

   What|Removed |Added

 CC||safety0ff.b...@gmail.com

--- Comment #3 from safety0ff.bugz  ---
(In reply to Denis Shelomovskii from comment #1)
> This issue caused druntime Issue 16974.

Druntime used to have a function rt.util.hash.hashOf with signature:
size_t hashOf( const(void)* buf, size_t len, size_t seed )

Which made up most references to 'hashOf' within druntime (by TypeInfos.)

I wouldn't be surprised if this bug was due to thinking it's calling
rt.util.hash.hashOf instead of object.hashOf.

Mistaking core.internal.hash.hashOf for rt.util.hash.hashOf was responsible for
a recent regression.

--


[Issue 16975] New: Top-level assert in contracts must be distinct from general assert

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16975

  Issue ID: 16975
   Summary: Top-level assert in contracts must be distinct from
general assert
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: and...@erdani.com

This is mostly an implementation matter, but it should help us (a) make the
working of contracts more rigorous, and (b) make contracts faster.

Consider:

void fun(R)(R r) if (isInputRange!R && is(ElementType!R == int))
in { assert(r.front == 42); }
body { ... }

This code has a contract stating that the front element of the range is equal
to 42. There is also an implied assumption that the range is not empty. The
range may, however, be empty and may signal that by throwing an AssertError, a
RangeError, some Exception object, etc. It is generally not specified how a
range shall enforce its own preconditions. Consequently, this onus cannot fall
on the shoulders of the contract of fun().

Generally there is a distinction between the assertions stated at top level
inside a contract, and whatever other assertions do. Generally a failing assert
is considered an unrecoverable error; however, in contracts that cannot be the
case. It follows that precondition-level asserts are qualitatively distinct
from asserts in arbitrary code.

In the particular example above, the formulation may be arguably a bug in the
formulation of the contract itself. If it is part of the precondition that the
range is not empty, that should be assert(!r.empty && r.front == 42).

There is precedent with failing asserts being handled differently: in
unittests, a failing assert invokes a different function than a failing assert
elsewhere.

Top-level asserts in preconditions should be lowered to simple code that checks
a Boolean and set a flag to (or return internally) false if the assertion
fails. Then the flag can be combined with that of inherited/derived conditions
etc.

--


[Issue 16960] implicit function return breaks chaining of exceptions

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16960

Yuxuan Shui  changed:

   What|Removed |Added

 CC||yshu...@gmail.com

--- Comment #4 from Yuxuan Shui  ---
(In reply to Mathias LANG from comment #1)
> This is UB, according to
> http://dlang.org/spec/statement.html#ScopeGuardStatement
> 
> > A scope(exit) or scope(success) statement may not exit with a throw, goto, 
> > break, continue, or return; nor may it be entered with a goto.

I don't think it make sense to forbid exiting scope block with a throw. Plus it
totally works barring a few bugs not specific to it.

--


[Issue 16973] `hashOf` has error-prone signature as `(T, seed)` may be confused with `(ptr, length)`

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16973

--- Comment #2 from Denis Shelomovskii  ---
A possible solution is to require explicit second argument type specification.

Using current language abilities it can be done with helper `seed` function or
struct:
---
hashOf(obj, seed(0));
---
or with function overload rename:
---
hashOfWithSeed(obj, 0);
---

--


[Issue 16973] `hashOf` has error-prone signature as `(T, seed)` may be confused with `(ptr, length)`

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16973

--- Comment #1 from Denis Shelomovskii  ---
This issue caused druntime Issue 16974.

--


[Issue 16974] Equal associative arrays with associative array keys are considered unequal

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16974

--- Comment #1 from Denis Shelomovskii  ---
The reason is incorrect hash calculation:
---
int[int] a = [1 : 2];
assert(typeid(a).getHash() == typeid(a).getHash()); // fails
---

Opened druntime pull 1715 [1].

This incorrect hash calculation became possible because of `hashOf` signature,
see Issue 16973.

[1] https://github.com/dlang/druntime/pull/1715

--


[Issue 16974] New: Equal associative arrays with associative array keys are considered unequal

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16974

  Issue ID: 16974
   Summary: Equal associative arrays with associative array keys
are considered unequal
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: wrong-code
  Severity: regression
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: verylonglogin@gmail.com

This code should run fine:
---
void main()
{
int[int] a = [1 : 2];
assert([a : 3] == [a : 3]);// fails
assert([a : 3] == [[1 : 2] : 3]);  // fails
}
---

--


[Issue 16684] std.getopt, problem with the automatic handling of "h"

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16684

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|alexandru.razva...@gmail.co
   ||m

--


[Issue 16686] Can not spawn subprocess and read from File at same time

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16686

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|alexandru.razva...@gmail.co
   ||m

--


[Issue 16783] std.net.curl application throws an exception

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16783

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com

--


[Issue 16595] thisExePath resolves symlinks but this isn't mentioned in docs

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16595

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|edi33...@gmail.com

--


[Issue 16736] Retrieving cUrl time values is quite cumbersome

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16736

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com

--


[Issue 16653] ParameterDefaultValueTuple fails to compile when function has lazy param

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16653

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|lucia.mcojoc...@gmail.com

--


[Issue 16959] bringToFront fails on char arrays

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16959

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com

--


[Issue 16662] Can't call std.variant.visit from a pure function

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16662

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|alexandru.razva...@gmail.co
   ||m

--


[Issue 16573] string-typed enum values pass isSomeString but not isInputRange

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16573

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com

--


[Issue 16542] makeArray not usable with const initializer

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16542

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|lucia.mcojoc...@gmail.com

--


[Issue 16630] Compile errors with std.traits.arity and std.traits.ParameterStorageClassTuple

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16630

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|lucia.mcojoc...@gmail.com

--


[Issue 16724] RandomCover.popFront is a no-op for the first call

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16724

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|alexandru.razva...@gmail.co
   ||m

--


[Issue 16634] std.math exposes yl2x and yl2xp1 publicly

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16634

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|lucia.mcojoc...@gmail.com

--


[Issue 16564] KRRegion.empty sometimes returns Ternary.no

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16564

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|lucia.mcojoc...@gmail.com

--


[Issue 16735] curl_easy_getinfo accepts wrong CURL type

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16735

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|alexandru.razva...@gmail.co
   ||m

--


[Issue 16604] [std.getopt] defaultGetoptPrinter can't be used if an exception fires

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16604

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|edi33...@gmail.com

--


[Issue 16824] std.experimental.allocator.dispose leaks memory for arrays of more than 1 dimension

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16824

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com

--


[Issue 16352] dead-lock in std.allocator.free_list unittest

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16352

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|edi33...@gmail.com

--


[Issue 16588] uniq's BidirectionalRange behavior is inconsistent with its InputRange behavior

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16588

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|edi33...@gmail.com

--


[Issue 16615] std.process is missing functionality for child processes

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16615

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Assignee|nob...@puremagic.com|edi33...@gmail.com

--


[Issue 16764] `hashOf` is misleading, error-prone, and useless

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16764

--- Comment #4 from Denis Shelomovskii  ---
So #1 and #3 are solved by the pull, but #2 still stays. Opened Issue 16973 for
it.

--


[Issue 16973] New: `hashOf` has error-prone signature as `(T, seed)` may be confused with `(ptr, length)`

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16973

  Issue ID: 16973
   Summary: `hashOf` has error-prone signature as `(T, seed)` may
be confused with `(ptr, length)`
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: verylonglogin@gmail.com

In our root `object` module we have a function `hashOf` [1] which accept any
type as the first parameter and optional seed as the second parameter.

This function signature is error-prone because its signature allows this
incorrect usage:
---
hashOf(arr.ptr, arr.length); // hash of ptr with seed set to length
---

It's a major issue as (ptr, length) usage pattern is common in programming and
incorrect hash function behavior is hard to debug.


[1] http://dlang.org/phobos/object.html#.hashOf

--


[Issue 16747] [Reg 2.072] Cannot have stack allocated classes in @safe code

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16747

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/a07034f2fe3a50622fedc810cf0ac775bbbfe1d3
fix Issue 16747 - Cannot have stack allocated classes in @safe code

https://github.com/dlang/dmd/commit/6936a2eca064847160b352ab7f4ab3251acd0d75
Merge pull request #6279 from WalterBright/fix16747

fix Issue 16747 - Cannot have stack allocated classes in @safe code

--


[Issue 16747] [Reg 2.072] Cannot have stack allocated classes in @safe code

2016-12-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16747

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--