Commit graph

104 commits

Author SHA1 Message Date
Sönke Ludwig 2a7bd18695 Allow TA(val, kind) construction for unique types, too. 2018-03-20 16:37:52 +01:00
Sönke Ludwig 5fc3e16a83 Enable opEquals between two TaggedAlgebraic!T values. 2018-03-20 16:33:13 +01:00
Sönke Ludwig c7f4533d17 Fix compilation errors caused by swap(). 2018-03-20 16:21:36 +01:00
Sönke Ludwig 100714d7b8 Add .gitignore. 2018-01-18 00:53:16 +01:00
Sönke Ludwig 445f1ef365 Fix test for frontend versions < 2.072.x. 2018-01-18 00:44:33 +01:00
Sönke Ludwig 3709a2298f Add test and close #8.
Was fixed by 513729bf59 for compiler frontend versions >= 2.072.x.
2018-01-18 00:31:00 +01:00
Sönke Ludwig 9b13f08a25 Fix compile error for overloaded TaggedAlgebraic returns. Fixes #13. 2018-01-18 00:29:16 +01:00
Sönke Ludwig 4438b542b2
Merge pull request #14 from s-ludwig/codecov
Switch to codecov.io
2018-01-18 00:10:28 +01:00
Sönke Ludwig f9c7d444e6 Disable TypeOf on frontent versions < 2.072.x 2018-01-18 00:06:06 +01:00
Sönke Ludwig f6e90bb0c9 Switch to codecov.io. 2018-01-18 00:02:06 +01:00
Sönke Ludwig a80b42bcc1 Test on DMD 2.078.0 and LDC 1.7.0. 2018-01-17 23:55:17 +01:00
Sönke Ludwig f87b378cf3 Add the TypeOf template. 2018-01-17 23:53:57 +01:00
Sönke Ludwig de7df6bfeb Fix hasType!T when called with rvalues. 2017-12-07 20:41:06 +01:00
Sönke Ludwig 47800db273 Test DMD 2.077.1 and LDC 1.6.0. 2017-12-07 20:30:07 +01:00
Sönke Ludwig 8e40777f0e
Merge pull request #12 from John-Colvin/fix_casting_assocArray
Fix casting assoc array
2017-12-07 20:18:48 +01:00
John Colvin ffe296a96f do implicit casting without std.conv.to 2017-12-07 15:59:12 +00:00
Sönke Ludwig 513729bf59 Enable proper default initialization.
Since @disable this() still leaves an invalid .init open, TaggedAlgebraic.init has now been changed to always contain the .init value of the first specified sub type.

Note that this change is restricted to DMD 2.072 and up, because earlier versions of DMD do not allow postblits or destructors within unions and using a union appears to be the only way to implement this.
2017-06-12 21:12:42 +02:00
Sönke Ludwig b4a4b3617b Generate coverage information for the latest DMD release. 2017-06-12 21:11:43 +02:00
Sönke Ludwig a7c77bba94
Fix compile error on DMD 2.068.2. 2017-06-12 21:06:55 +02:00
Sönke Ludwig 67a0463fa0 Test on all current compiler versions. 2017-06-12 20:47:15 +02:00
Sönke Ludwig be4a93e553
Make apply() work for plain values, too.
This provides symmetry between TaggedAlgebraic values and ordinary values.
2017-05-28 22:28:39 +02:00
Sönke Ludwig 50e80dc0d9
Add apply() to generically extract the contained value.
See also #3.
2017-05-28 22:05:19 +02:00
Sönke Ludwig e4c5ec700a Add non-ref overload of get(). 2016-11-22 18:02:34 +01:00
Sönke Ludwig 4a506f458b Make TaggedAlgebraic.Union public. 2016-11-21 20:21:23 +01:00
Sönke Ludwig 537f17f71a Add assertion error message. 2016-11-21 20:20:14 +01:00
Sönke Ludwig 58a1cc274f Add a proper workaround for the void intializer error in DMD 2.072.0-b2. 2016-10-10 12:32:42 +02:00
Sönke Ludwig 01f1b3025e Test on the latest DMD versions. 2016-10-10 11:40:45 +02:00
Sönke Ludwig baad665621 Work around stricter memory-safety checks in DMD 2.072.0-b2. 2016-10-10 11:16:55 +02:00
Sönke Ludwig 2d9f9c537f Merge pull request #5 from Abscissa/master
Document basic usage.
2016-09-20 08:30:02 +02:00
Nick Sabalausky 8197549929 Document basic usage. 2016-09-20 00:52:02 -04:00
Sönke Ludwig c0c5512902 Convert package recipe to SDLang. 2016-07-04 11:18:58 +02:00
Sönke Ludwig a0415ed13c Improve dynamic type conversion.
- Uses std.conv.to to implement opCast instead of just supporting implicit type conversions
- Adds .toString to make to!string(ta) return the expected result
2016-04-04 13:40:58 +02:00
Sönke Ludwig c59fae1b2e Syntax fix. 2016-01-29 11:43:39 +01:00
Sönke Ludwig 70ba67a9b0 Add Coveralls badge. 2016-01-29 11:42:06 +01:00
Sönke Ludwig 07646cda2e Only perform coverage analysis for one compiler version. 2016-01-29 11:41:02 +01:00
Sönke Ludwig c592c31340 Attempt to add Coveralls coverage analysis. 2016-01-29 11:36:05 +01:00
Sönke Ludwig e5f9e9d092 Remove test support for 2.067.x. See #2. 2016-01-27 23:12:50 +01:00
Sönke Ludwig 89e90b962f Fix unit test. See #2. 2016-01-27 23:11:32 +01:00
Sönke Ludwig 00d138d940 Add README.md. 2016-01-27 23:08:17 +01:00
Sönke Ludwig e1f57483d6 Add .travis.yml and .editorconfig. See #2. 2016-01-27 23:02:37 +01:00
Sönke Ludwig df23609f3d Fix "statement not reachable" errors. 2015-12-06 14:57:30 +01:00
Sönke Ludwig 96f18356f7 Output a proper error message when using hasType with an invalid type. Fixes #1. 2015-08-27 11:27:57 +02:00
Sönke Ludwig 84d6c8da80 Rename "type" to "kind".
Although there will be situations where the enum names equal the name of the types stored in a TaggedAlgebraic, "type" is often not the right term. It's also possible to define multiple fields of the same type, but with different names. "Kind" is used now as a more generic alternative.
2015-08-27 11:00:16 +02:00
Sönke Ludwig 591b45ca8f Use a JSON package recipe for now. 2015-08-17 19:05:57 +02:00
Sönke Ludwig d02baa57ac Add opBinaryRight forwarding. 2015-08-17 15:53:47 +02:00
Sönke Ludwig f8835076f8 Improve operator forwarding.
- Added @disableIndex to disable opIndex forwarding for certain fields
- Added field/properly forwarding
- Fixed binary operator overloading
- Allow implicit conversions when trying to match return types to TaggedAlgebraic during operator return type deduction
2015-08-17 15:49:32 +02:00
Sönke Ludwig 8fba150b03 Add limited support for operations where the RHS is a TaggedAlgebraic. 2015-08-14 11:24:54 +02:00
Sönke Ludwig d38c8d472d Add some more tests. 2015-08-13 23:43:09 +02:00
Sönke Ludwig f06a793dae Add support for opCall forwarding and add default assignment operator. 2015-08-13 16:11:30 +02:00
Sönke Ludwig d901bfa810 Add UFCS functions get and hasType. 2015-08-13 15:59:50 +02:00