diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 3ba3de754..e0d46651d 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fable": { - "version": "3.7.20", + "version": "4.1.4", "commands": [ "fable" ] diff --git a/.github/workflows/fable.yml b/.github/workflows/fable.yml index 99669df08..e4c036c29 100644 --- a/.github/workflows/fable.yml +++ b/.github/workflows/fable.yml @@ -39,7 +39,43 @@ jobs: - name: Run Fable tests working-directory: tests/FSharpPlusFable.Tests run: fable . --outDir bin --runScript ./bin - + + testfable4: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Restore + run: git submodule update --init --recursive + - name: Remove global json + run: rm global.json + - name: Setup .NET Core 7 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.200 + - name: Setup .NET Core 6 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.201 + - name: Restore tools + run: dotnet tool restore + - name: Install jq + uses: dcarbone/install-jq-action@v1.0.1 + - name: Install fable + run: | + version=`cat ./.config/dotnet-tools.json | jq --raw-output '.tools.fable.version'` + dotnet tool install --global Fable --version $version + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '18.x' + - name: Install npm dependencies + working-directory: tests/FSharpPlusFable.Tests + run: npm install + - name: Run Fable tests + working-directory: tests/FSharpPlusFable.Tests + run: fable . --outDir bin --runScript ./bin + testFable3SubsetOnCore: runs-on: ubuntu-latest diff --git a/src/FSharpPlus/Builders.fs b/src/FSharpPlus/Builders.fs index dd2b69f8c..0936ae1df 100644 --- a/src/FSharpPlus/Builders.fs +++ b/src/FSharpPlus/Builders.fs @@ -11,7 +11,7 @@ namespace FSharpPlus #nowarn "40" -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Constructs to express generic computations [] diff --git a/src/FSharpPlus/Control/Alternative.fs b/src/FSharpPlus/Control/Alternative.fs index 23299b3b4..9592be0d0 100644 --- a/src/FSharpPlus/Control/Alternative.fs +++ b/src/FSharpPlus/Control/Alternative.fs @@ -6,7 +6,7 @@ namespace FSharpPlus.Control /// /// -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System.Runtime.InteropServices open FSharpPlus diff --git a/src/FSharpPlus/Control/Applicative.fs b/src/FSharpPlus/Control/Applicative.fs index 6256867ae..2223d39cf 100644 --- a/src/FSharpPlus/Control/Applicative.fs +++ b/src/FSharpPlus/Control/Applicative.fs @@ -14,7 +14,7 @@ open FSharpPlus.Data type Apply = inherit Default1 -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member inline ``<*>`` (f: '``Monad<'T->'U>`` , x: '``Monad<'T>`` , []_output: '``Monad<'U>`` , []_mthd:Default2) : '``Monad<'U>`` = Bind.InvokeOnInstance f (fun (x1: 'T->'U) -> Bind.InvokeOnInstance x (fun x2 -> Return.InvokeOnInstance (x1 x2))) static member inline ``<*>`` (f: '``Applicative<'T->'U>``, x: '``Applicative<'T>``, []_output: '``Applicative<'U>``, []_mthd:Default1) : '``Applicative<'U>`` = ((^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>) : _*_ -> _) f, x) @@ -87,7 +87,7 @@ type Apply = static member inline InvokeOnInstance (f: '``Applicative<'T->'U>``) (x: '``Applicative<'T>``) : '``Applicative<'U>`` = ((^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>) : _*_ -> _) (f, x)) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Lift2 = inherit Default1 diff --git a/src/FSharpPlus/Control/Arrow.fs b/src/FSharpPlus/Control/Arrow.fs index ae4178ef3..b3abe037b 100644 --- a/src/FSharpPlus/Control/Arrow.fs +++ b/src/FSharpPlus/Control/Arrow.fs @@ -1,7 +1,7 @@ namespace FSharpPlus.Control #nowarn "0077" -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System open System.Runtime.InteropServices diff --git a/src/FSharpPlus/Control/ArrowApply.fs b/src/FSharpPlus/Control/ArrowApply.fs index cdbd66ec1..b5fd722fe 100644 --- a/src/FSharpPlus/Control/ArrowApply.fs +++ b/src/FSharpPlus/Control/ArrowApply.fs @@ -4,7 +4,7 @@ open System open System.Runtime.InteropServices open FSharpPlus.Internals -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // ArrowApply class ------------------------------------------------------- diff --git a/src/FSharpPlus/Control/ArrowChoice.fs b/src/FSharpPlus/Control/ArrowChoice.fs index 214dfde96..a4da4bc43 100644 --- a/src/FSharpPlus/Control/ArrowChoice.fs +++ b/src/FSharpPlus/Control/ArrowChoice.fs @@ -1,7 +1,7 @@ namespace FSharpPlus.Control #nowarn "0077" -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System open System.Runtime.InteropServices diff --git a/src/FSharpPlus/Control/Bifoldable.fs b/src/FSharpPlus/Control/Bifoldable.fs index e6d746b2f..384e535e7 100644 --- a/src/FSharpPlus/Control/Bifoldable.fs +++ b/src/FSharpPlus/Control/Bifoldable.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System.Runtime.InteropServices open FSharpPlus.Internals diff --git a/src/FSharpPlus/Control/Bitraversable.fs b/src/FSharpPlus/Control/Bitraversable.fs index 2157044ed..7c08aa72c 100644 --- a/src/FSharpPlus/Control/Bitraversable.fs +++ b/src/FSharpPlus/Control/Bitraversable.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // open System.Runtime.InteropServices open FSharpPlus.Internals diff --git a/src/FSharpPlus/Control/Category.fs b/src/FSharpPlus/Control/Category.fs index 2cf8563f4..9cfe4657d 100644 --- a/src/FSharpPlus/Control/Category.fs +++ b/src/FSharpPlus/Control/Category.fs @@ -1,7 +1,7 @@ namespace FSharpPlus.Control #nowarn "0077" -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System open System.Runtime.InteropServices diff --git a/src/FSharpPlus/Control/Collection.fs b/src/FSharpPlus/Control/Collection.fs index a6dfd58da..580e9b69f 100644 --- a/src/FSharpPlus/Control/Collection.fs +++ b/src/FSharpPlus/Control/Collection.fs @@ -8,7 +8,7 @@ open System.Runtime.InteropServices open FSharpPlus open FSharpPlus.Internals -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type OfSeq = inherit Default1 diff --git a/src/FSharpPlus/Control/Comonad.fs b/src/FSharpPlus/Control/Comonad.fs index 80959abd9..d8575eb60 100644 --- a/src/FSharpPlus/Control/Comonad.fs +++ b/src/FSharpPlus/Control/Comonad.fs @@ -6,13 +6,13 @@ open System.Threading.Tasks open FSharpPlus open FSharpPlus.Internals - +#if !FABLE_COMPILER4 // Comonad class ---------------------------------------------------------- type Extract = static member Extract (x: Async<'T> ) = - #if FABLE_COMPILER_3 + #if FABLE_COMPILER_3 || FABLE_COMPILER_4 Async.RunSynchronously x #else Async.StartImmediateAsTask(x).Result @@ -118,3 +118,4 @@ type Duplicate = call (Unchecked.defaultof, x, Unchecked.defaultof<'``Comonad<'Comonad<'T>>``>) #endif +#endif \ No newline at end of file diff --git a/src/FSharpPlus/Control/Converter.fs b/src/FSharpPlus/Control/Converter.fs index 02cfe7609..c3398f45a 100644 --- a/src/FSharpPlus/Control/Converter.fs +++ b/src/FSharpPlus/Control/Converter.fs @@ -10,7 +10,7 @@ open System.Text open FSharpPlus.Internals open FSharpPlus.Internals.Prelude -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Explicit = inherit Default1 diff --git a/src/FSharpPlus/Control/Foldable.fs b/src/FSharpPlus/Control/Foldable.fs index ab138d6ea..60f4dc1c2 100644 --- a/src/FSharpPlus/Control/Foldable.fs +++ b/src/FSharpPlus/Control/Foldable.fs @@ -4,7 +4,7 @@ // Warn FS0077 -> Member constraints with the name 'get_Item' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code. // Those .NET types are string and array. String is explicitely handled here and array through the seq overload. -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus.Control diff --git a/src/FSharpPlus/Control/Functor.fs b/src/FSharpPlus/Control/Functor.fs index 28972099c..ffa4ae93b 100644 --- a/src/FSharpPlus/Control/Functor.fs +++ b/src/FSharpPlus/Control/Functor.fs @@ -13,7 +13,7 @@ open FSharpPlus.Internals.Prelude open FSharpPlus open FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && ! FABLE_COMPILER_4 // Functor class ---------------------------------------------------------- @@ -61,7 +61,7 @@ type Iterate = type Map = inherit Default1 -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member Map ((x: Lazy<_> , f: 'T->'U), _mthd: Map) = Lazy.map f x #if !FABLE_COMPILER @@ -113,7 +113,7 @@ type Map = static member inline InvokeOnInstance (mapping: 'T->'U) (source: '``Functor<'T>``) : '``Functor<'U>`` = (^``Functor<'T>`` : (static member Map : _ * _ -> _) source, mapping) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Map with @@ -139,7 +139,7 @@ type Map with static member inline Map ((_: ^t when ^t: null and ^t: struct, _ ), _mthd: Default1) = () #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Unzip = inherit Default1 @@ -199,7 +199,7 @@ type Unzip = call (Unchecked.defaultof, source) : '``Functor<'T1>`` * '``Functor<'T2>`` #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Zip = inherit Default1 @@ -239,7 +239,7 @@ type Zip with static member inline Zip ((x: '``ZipFunctor<'T1>`` , y: '``ZipFunctor<'T2>`` , _output: '``ZipFunctor<'T1 * 'T2>`` ), _mthd: Default1) = Zip.InvokeOnInstance x y : '``ZipFunctor<'T1 * 'T2>`` #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // Bifunctor class -------------------------------------------------------- @@ -260,7 +260,7 @@ type Bimap = (^``Bifunctor<'T,'V>``: (static member Bimap : _*_*_ -> _) source, f, g) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type MapFirst = inherit Default1 @@ -312,7 +312,7 @@ type Dimap = (^``Profunctor<'B,'C>`` : (static member Dimap : _*_*_ -> _) source, ab, cd) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // Contravariant class ---------------------------------------------------- @@ -338,7 +338,7 @@ type Contramap = #endif #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Contramap with static member inline Contramap (x: '``Profunctor<'B,'C>``, f: 'A->'B, []_mthd: Default2) = Dimap.InvokeOnInstance f id x : '``Profunctor<'A,'C>`` @@ -346,13 +346,13 @@ type Contramap with static member inline Contramap (_: ^t when ^t: null and ^t: struct , _: 'A->'B, _mthd: Default1) = () #endif -#if !FABLE_COMPILER|| FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Map with static member inline Map ((x: '``Profunctor<'B,'C>``, cd: 'C->'D), []_mthd: Default5) = Dimap.InvokeOnInstance id cd x : '``Profunctor<'B,'D>`` #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Dimap with static member inline Dimap (x: '``Profunctor<'B,'C>``, ab: 'A->'B, cd: 'C->'D, []_mthd: Default2) = x |> Map.InvokeOnInstance cd |> Contramap.InvokeOnInstance ab : '``Profunctor<'A,'D>`` diff --git a/src/FSharpPlus/Control/Indexable.fs b/src/FSharpPlus/Control/Indexable.fs index 0884c115b..d3882dea6 100644 --- a/src/FSharpPlus/Control/Indexable.fs +++ b/src/FSharpPlus/Control/Indexable.fs @@ -4,7 +4,7 @@ // Warn FS0077 -> Member constraints with the name 'get_Item' are given special status by the F# compiler as certain .NET types are implicitly augmented with this member. This may result in runtime failures if you attempt to invoke the member constraint from your own code. // Those .NET types are string and array but they are explicitely handled here. -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System open System.Runtime.InteropServices diff --git a/src/FSharpPlus/Control/Invokable.fs b/src/FSharpPlus/Control/Invokable.fs index 13fd2728b..0eba3b723 100644 --- a/src/FSharpPlus/Control/Invokable.fs +++ b/src/FSharpPlus/Control/Invokable.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System open FSharpPlus.Internals diff --git a/src/FSharpPlus/Control/Monad.fs b/src/FSharpPlus/Control/Monad.fs index 89635d765..15ff7be77 100644 --- a/src/FSharpPlus/Control/Monad.fs +++ b/src/FSharpPlus/Control/Monad.fs @@ -12,7 +12,7 @@ open FSharpPlus.Data open FSharpPlus.Internals open FSharpPlus.Internals.Prelude - +#if !FABLE_COMPILER_4 // Monad class ------------------------------------------------------------ type Bind = @@ -128,7 +128,7 @@ type Return = inherit Default1 static member inline InvokeOnInstance (x: 'T) = (^``Applicative<'T>`` : (static member Return : ^T -> ^``Applicative<'T>``) x) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member inline Invoke (x: 'T) : '``Applicative<'T>`` = let inline call (mthd: ^M, output: ^R) = ((^M or ^R) : (static member Return : _*_ -> _) output, mthd) @@ -329,3 +329,4 @@ type Using with static member inline Using (_ , _ : 'a -> ^t when ^t : null and ^t: struct , _: Using ) = () #endif +#endif diff --git a/src/FSharpPlus/Control/MonadOps.fs b/src/FSharpPlus/Control/MonadOps.fs index 48970ced1..9e7409f20 100644 --- a/src/FSharpPlus/Control/MonadOps.fs +++ b/src/FSharpPlus/Control/MonadOps.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Internals -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 module internal MonadOps = open FSharpPlus.Control diff --git a/src/FSharpPlus/Control/MonadTrans.fs b/src/FSharpPlus/Control/MonadTrans.fs index ec20c437c..0f40ac319 100644 --- a/src/FSharpPlus/Control/MonadTrans.fs +++ b/src/FSharpPlus/Control/MonadTrans.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus diff --git a/src/FSharpPlus/Control/Monoid.fs b/src/FSharpPlus/Control/Monoid.fs index 35adb4262..a91b65849 100644 --- a/src/FSharpPlus/Control/Monoid.fs +++ b/src/FSharpPlus/Control/Monoid.fs @@ -12,7 +12,7 @@ open FSharpPlus.Data open FSharpPlus.Internals open FSharpPlus.Internals.Prelude -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] type Plus = diff --git a/src/FSharpPlus/Control/Numeric.fs b/src/FSharpPlus/Control/Numeric.fs index 2146481d3..55e2bea8c 100644 --- a/src/FSharpPlus/Control/Numeric.fs +++ b/src/FSharpPlus/Control/Numeric.fs @@ -42,7 +42,7 @@ type FromBigInt = call Unchecked.defaultof x #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type FromInt64 = inherit Default1 diff --git a/src/FSharpPlus/Control/Traversable.fs b/src/FSharpPlus/Control/Traversable.fs index 5fd04e3a8..f977aad99 100644 --- a/src/FSharpPlus/Control/Traversable.fs +++ b/src/FSharpPlus/Control/Traversable.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System.Runtime.InteropServices open System.ComponentModel diff --git a/src/FSharpPlus/Control/Tuple.fs b/src/FSharpPlus/Control/Tuple.fs index 0cc1564b9..a29772af7 100644 --- a/src/FSharpPlus/Control/Tuple.fs +++ b/src/FSharpPlus/Control/Tuple.fs @@ -161,7 +161,7 @@ type MapItem5 = call (Unchecked.defaultof, value) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Curry = static member inline Invoke f = diff --git a/src/FSharpPlus/Data/Cont.fs b/src/FSharpPlus/Data/Cont.fs index 9aec5f299..1b2296d75 100644 --- a/src/FSharpPlus/Data/Cont.fs +++ b/src/FSharpPlus/Data/Cont.fs @@ -90,7 +90,7 @@ type Cont<'r,'t> with [] static member CallCC (f: ('T -> Cont<'R,'U>) -> _) = Cont.callCC f : Cont<'R,'T> -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member inline Lift (m: '``Monad<'T>``) = Cont ((>>=) m) : ContT<'``Monad<'R>``,'T> diff --git a/src/FSharpPlus/Data/Coproduct.fs b/src/FSharpPlus/Data/Coproduct.fs index 9dc662945..4385c44f9 100644 --- a/src/FSharpPlus/Data/Coproduct.fs +++ b/src/FSharpPlus/Data/Coproduct.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus open FSharpPlus.Control diff --git a/src/FSharpPlus/Data/Error.fs b/src/FSharpPlus/Data/Error.fs index a226b59df..125fd1d83 100644 --- a/src/FSharpPlus/Data/Error.fs +++ b/src/FSharpPlus/Data/Error.fs @@ -7,7 +7,7 @@ open FSharpPlus.Internals.Prelude open FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Additional operations on Result [] module Result = @@ -30,7 +30,7 @@ module ResultOrException = let Exception : Result<_,exn> -> _ = function Error e -> e | _ -> exn () -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Monad Transformer for Result<'T, 'E> [] diff --git a/src/FSharpPlus/Data/Kleisli.fs b/src/FSharpPlus/Data/Kleisli.fs index 067197909..20f67275b 100644 --- a/src/FSharpPlus/Data/Kleisli.fs +++ b/src/FSharpPlus/Data/Kleisli.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus open FSharpPlus.Control diff --git a/src/FSharpPlus/Data/List.fs b/src/FSharpPlus/Data/List.fs index 814cfa892..e75361ca6 100644 --- a/src/FSharpPlus/Data/List.fs +++ b/src/FSharpPlus/Data/List.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus open System.ComponentModel diff --git a/src/FSharpPlus/Data/Monoids.fs b/src/FSharpPlus/Data/Monoids.fs index 8a92bd8de..69da14a38 100644 --- a/src/FSharpPlus/Data/Monoids.fs +++ b/src/FSharpPlus/Data/Monoids.fs @@ -1,10 +1,9 @@ namespace FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 - open FSharpPlus open FSharpPlus.Internals.Prelude +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// The dual of a monoid, obtained by swapping the arguments of append. [] type Dual<'t> = Dual of 't with @@ -41,7 +40,7 @@ type Any = Any of bool with static member (+) (Any x, Any y) = Any (x || y) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// The Const functor, defined as Const<'T, 'U> where 'U is a phantom type. Useful for: Lens getters Its applicative instance plays a fundamental role in Lens. /// Useful for: Lens getters. @@ -129,7 +128,7 @@ type Last<'t> = Last of Option<'t> with static member run (Last a) = a : 't option -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Numeric wrapper for multiplication monoid (*, 1) [] diff --git a/src/FSharpPlus/Data/NonEmptyList.fs b/src/FSharpPlus/Data/NonEmptyList.fs index 772cba39c..a19944d37 100644 --- a/src/FSharpPlus/Data/NonEmptyList.fs +++ b/src/FSharpPlus/Data/NonEmptyList.fs @@ -129,7 +129,7 @@ module NonEmptyList = | [] -> {Head = s; Tail = []} | h::t -> cons s (tails {Head = h; Tail = t}) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// /// Maps each element of the list to an action, evaluates these actions from left to right and collect the results. @@ -200,7 +200,7 @@ module NonEmptyList = /// Equivalent to [start..stop] on regular lists. let inline range (start: 'T) stop = create start (List.drop 1 [start..stop]) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Reduces using alternative operator `<|>`. let inline choice (list: NonEmptyList<'``Alt<'T>``>) = reduce (<|>) list : '``Alt<'T>`` #endif @@ -244,7 +244,7 @@ type NonEmptyList<'t> with static member Extract {Head = h; Tail = _} = h : 't - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member Duplicate (s: NonEmptyList<'a>, []_impl: Duplicate) = NonEmptyList.tails s #endif @@ -257,7 +257,7 @@ type NonEmptyList<'t> with static member FoldBack ({Head = x; Tail = xs}, f, z) = List.foldBack f (x::xs) z static member Sum (source: seq>) = source |> Seq.map NonEmptyList.toList |> List.concat |> NonEmptyList.ofList - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] static member ToList (s: NonEmptyList<'a>, []_impl: ToList) = NonEmptyList.toList s diff --git a/src/FSharpPlus/Data/NonEmptyMap.fs b/src/FSharpPlus/Data/NonEmptyMap.fs index bc08c9462..406b98241 100644 --- a/src/FSharpPlus/Data/NonEmptyMap.fs +++ b/src/FSharpPlus/Data/NonEmptyMap.fs @@ -246,7 +246,7 @@ module NonEmptyMap = /// Returns the union of two maps, preferring values from the first in case of duplicate keys. let union (source: NonEmptyMap<'Key, 'T>) (altSource: NonEmptyMap<'Key, 'T>) = unionWith (fun x _ -> x) source altSource -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let inline traverse (f: 'T->'``Functor<'U>``) (m: NonEmptyMap<'K, 'T>) : '``Functor>`` = let m' = traverse f (toMap m) : '``Functor>`` ofMap m' : '``Functor>`` @@ -266,7 +266,7 @@ type NonEmptyMap<[]'Key,[] static member Unzip (x: NonEmptyMap<'K, ('T * 'U)>) = NonEmptyMap.unzip x : NonEmptyMap<'K, 'T> * NonEmptyMap<'K, 'U> - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] static member inline Traverse (x: NonEmptyMap<'K, 'T>, f: 'T->'``Functor<'U>``) : '``Functor>`` = NonEmptyMap.traverse f x diff --git a/src/FSharpPlus/Data/NonEmptySet.fs b/src/FSharpPlus/Data/NonEmptySet.fs index 0bce60fec..c3b1f620b 100644 --- a/src/FSharpPlus/Data/NonEmptySet.fs +++ b/src/FSharpPlus/Data/NonEmptySet.fs @@ -235,7 +235,7 @@ type NonEmptySet<[]'a when 'a: comparison> with [] static member FoldBack (set: NonEmptySet<'a>, f, z) = Set.foldBack f set.Value z - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] static member ToList (s: NonEmptySet<'a>, []_impl: ToList) = NonEmptySet.toList s diff --git a/src/FSharpPlus/Data/Option.fs b/src/FSharpPlus/Data/Option.fs index 7935d333b..aadb747b0 100644 --- a/src/FSharpPlus/Data/Option.fs +++ b/src/FSharpPlus/Data/Option.fs @@ -6,7 +6,7 @@ open FSharpPlus.Internals.Prelude open FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Additional operations on Option [] diff --git a/src/FSharpPlus/Data/Reader.fs b/src/FSharpPlus/Data/Reader.fs index 3879f6f78..c14deaa4d 100644 --- a/src/FSharpPlus/Data/Reader.fs +++ b/src/FSharpPlus/Data/Reader.fs @@ -76,7 +76,7 @@ type Reader<'r,'t> with [] static member Local (m, f: 'R1->'R2) = Reader.local f m : Reader<'R1,'T> - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] static member Zip (x, y) = Reader.zip x y @@ -91,7 +91,7 @@ type Reader<'r,'t> with static member Delay (body: unit->Reader<'R,'T>) = Reader (fun s -> Reader.run (body ()) s) : Reader<'R,'T> -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Monad Transformer for Reader<'R, 'T> [] diff --git a/src/FSharpPlus/Data/Seq.fs b/src/FSharpPlus/Data/Seq.fs index d552d9056..33850ffd9 100644 --- a/src/FSharpPlus/Data/Seq.fs +++ b/src/FSharpPlus/Data/Seq.fs @@ -1,6 +1,6 @@ namespace FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open System.ComponentModel open FSharpPlus diff --git a/src/FSharpPlus/Data/State.fs b/src/FSharpPlus/Data/State.fs index 8a28e223f..ae09e37b6 100644 --- a/src/FSharpPlus/Data/State.fs +++ b/src/FSharpPlus/Data/State.fs @@ -94,7 +94,7 @@ type State<'s,'t> with [] static member Put x = State.put x : State<'S,unit> - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] static member Zip (x, y) = State.zip x y #endif @@ -105,7 +105,7 @@ type State<'s,'t> with static member Delay (body: unit->State<'S,'T>) = State (fun s -> State.run (body ()) s) : State<'S,'T> -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus.Control open FSharpPlus.Internals.Prelude diff --git a/src/FSharpPlus/Data/Validation.fs b/src/FSharpPlus/Data/Validation.fs index 42906d4e4..ab2513d31 100644 --- a/src/FSharpPlus/Data/Validation.fs +++ b/src/FSharpPlus/Data/Validation.fs @@ -5,7 +5,7 @@ namespace FSharpPlus.Data open System.ComponentModel open FSharpPlus -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus.Lens #endif @@ -89,7 +89,7 @@ module Validation = | Success a -> folder a state | Failure _ -> state - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Traverse the Success case with the supplied function. let inline traverse (f: 'T -> '``Functor<'U>``) (source: Validation<'Error, 'T>) : '``Functor>`` = @@ -196,7 +196,7 @@ module Validation = [] let validate (e: 'e) (p: 'a -> bool) (a: 'a) : Validation<'e,'a> = if p a then Success a else Failure e - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// validationNel : Result<'a,'e> -> Validation (NonEmptyList<'e>) a /// This is 'liftError' specialized to 'NonEmptyList', since /// they are a common semigroup to use. @@ -218,7 +218,7 @@ module Validation = let inline _Success x = (prism Success <| either Ok (Error << Failure)) x let inline _Failure x = (prism Failure <| either (Error << Failure) Ok) x #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let inline isoValidationResult x = x |> iso toResult ofResult #endif @@ -270,7 +270,7 @@ type Validation<'error, 't> with static member inline Lift3 (f, x: Validation<'Error, 'T>, y: Validation<_, 'U>, z: Validation<_, 'V>) : Validation<_, 'W> = Validation.map3 f x y z // as Alternative (inherits from Applicative) - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member inline get_Empty () = Failure (getEmpty ()) static member inline (<|>) (x: Validation<'Error, 'T>, y: Validation<_,_>) = Validation.appValidation Control.Append.Invoke x y #endif @@ -289,7 +289,7 @@ type Validation<'error, 't> with [] static member Bimap (x: Validation<'T, 'V>, f: 'T -> 'U, g: 'V -> 'W) : Validation<'U, 'W> = Validation.bimap f g x - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // as Traversable [] diff --git a/src/FSharpPlus/Data/ValueOption.fs b/src/FSharpPlus/Data/ValueOption.fs index e698a2370..fb7b42719 100644 --- a/src/FSharpPlus/Data/ValueOption.fs +++ b/src/FSharpPlus/Data/ValueOption.fs @@ -6,7 +6,7 @@ open FSharpPlus.Internals.Prelude open FSharpPlus.Control -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Additional operations on ValueOption [] diff --git a/src/FSharpPlus/Data/Writer.fs b/src/FSharpPlus/Data/Writer.fs index 1b1109d94..80748a958 100644 --- a/src/FSharpPlus/Data/Writer.fs +++ b/src/FSharpPlus/Data/Writer.fs @@ -22,7 +22,7 @@ module Writer = let map f (Writer (a: 'T, w)) = Writer (f a, w) : Writer<'Monoid,'U> - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Combines two Writers into one by applying a mapping function. let inline map2 f (Writer (a: 'T, w1)) (Writer (b: 'U, w2)) = Writer (f a b, w1 ++ w2) : Writer<'Monoid,'V> @@ -106,7 +106,7 @@ type Writer<'monoid,'t> with static member Extract (Writer (_: 'W, a: 'T)) = a static member (=>>) (Writer (w: 'W, _: 'T) as g, f : Writer<_,_> -> 'U) = Writer (w, f g) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Monad Transformer for Writer<'Monoid, 'T> diff --git a/src/FSharpPlus/Data/ZipList.fs b/src/FSharpPlus/Data/ZipList.fs index 4f89515ea..72d5c5fb0 100644 --- a/src/FSharpPlus/Data/ZipList.fs +++ b/src/FSharpPlus/Data/ZipList.fs @@ -53,7 +53,7 @@ type ZipList<'s> with static member ToSeq (ZipList x) = x -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 static member inline get_Zero () = result (getZero ()) : ZipList<'a> static member inline (+) (x: ZipList<'a>, y: ZipList<'a>) = lift2 plus x y : ZipList<'a> diff --git a/src/FSharpPlus/Extensions/Array.fs b/src/FSharpPlus/Extensions/Array.fs index 05a163d4d..b70e57acf 100644 --- a/src/FSharpPlus/Extensions/Array.fs +++ b/src/FSharpPlus/Extensions/Array.fs @@ -150,7 +150,7 @@ module Array = /// /// The index of the slice. /// - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// /// Returns the index of the first occurrence of the specified slice in the source. diff --git a/src/FSharpPlus/Extensions/Enumerator.fs b/src/FSharpPlus/Extensions/Enumerator.fs index 6bd7068da..f681dfc44 100644 --- a/src/FSharpPlus/Extensions/Enumerator.fs +++ b/src/FSharpPlus/Extensions/Enumerator.fs @@ -1,6 +1,6 @@ namespace FSharpPlus -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Additional operations on IEnumerator [] diff --git a/src/FSharpPlus/Extensions/List.fs b/src/FSharpPlus/Extensions/List.fs index 6e9a09022..b11cf15d6 100644 --- a/src/FSharpPlus/Extensions/List.fs +++ b/src/FSharpPlus/Extensions/List.fs @@ -77,7 +77,7 @@ module List = /// /// List with values returned from mapping function. let lift3 f x1 x2 x3 = - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if !FABLE_COMPILER || FABLE_COMPILER_3 || FABLE_COMPILER_4 List.allPairs x2 x3 |> List.allPairs x1 |> List.map (fun x -> (fst (snd x), snd (snd x), fst x)) @@ -243,7 +243,7 @@ module List = member _.GetEnumerator () = (source :> _ seq).GetEnumerator () member _.GetEnumerator () = (source :> System.Collections.IEnumerable).GetEnumerator () } - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// /// Gets the index of the first occurrence of the specified slice in the source. diff --git a/src/FSharpPlus/Extensions/Seq.fs b/src/FSharpPlus/Extensions/Seq.fs index 44f1e3a10..a51e6eea9 100644 --- a/src/FSharpPlus/Extensions/Seq.fs +++ b/src/FSharpPlus/Extensions/Seq.fs @@ -203,7 +203,7 @@ module Seq = /// The seq converted to a System.Collections.Generic.IReadOnlyList let toIReadOnlyList (source: seq<_>) = source |> ResizeArray |> ReadOnlyCollection :> IReadOnlyList<_> #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// /// Gets the index of the first occurrence of the specified slice in the source. /// diff --git a/src/FSharpPlus/FSharpPlus.fsproj b/src/FSharpPlus/FSharpPlus.fsproj index dd139e99f..9202db334 100644 --- a/src/FSharpPlus/FSharpPlus.fsproj +++ b/src/FSharpPlus/FSharpPlus.fsproj @@ -24,6 +24,7 @@ 6.0 $(DefineConstants);FABLE_COMPILER $(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_3 + $(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_4 netstandard2.0;netstandard2.1 diff --git a/src/FSharpPlus/Internals.fs b/src/FSharpPlus/Internals.fs index 646b0d4bf..5f0a7a90b 100644 --- a/src/FSharpPlus/Internals.fs +++ b/src/FSharpPlus/Internals.fs @@ -322,7 +322,7 @@ type BitConverter = if isNull value then nullArg "value" BitConverter.ToString (value, startIndex, value.Length - startIndex) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // findSliceIndex module FindSliceIndex = open System.Collections.Generic diff --git a/src/FSharpPlus/Lens.fs b/src/FSharpPlus/Lens.fs index cf74089fb..b4e992a00 100644 --- a/src/FSharpPlus/Lens.fs +++ b/src/FSharpPlus/Lens.fs @@ -1,6 +1,6 @@ namespace FSharpPlus -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus.Operators open FSharpPlus.Data diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs index b76ec9d42..0501efa6a 100644 --- a/src/FSharpPlus/Operators.fs +++ b/src/FSharpPlus/Operators.fs @@ -29,7 +29,7 @@ module Operators = /// Common Combinators let inline uncurry f (x: 'T1, y: 'T2) : 'Result = f x y - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// /// Takes a function expecting a tuple of any N number of elements and returns a function expecting N curried arguments. /// @@ -116,7 +116,7 @@ module Operators = /// Common Combinators let inline tuple8<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7, 'T8> (t1: 'T1) (t2: 'T2) (t3: 'T3) (t4: 'T4) (t5: 'T5) (t6: 'T6) (t7: 'T7) (t8: 'T8) = t1, t2, t3, t4, t5, t6, t7, t8 - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // Functor ---------------------------------------------------------------- @@ -389,7 +389,7 @@ module Operators = let inline invmap (f: 'T -> 'U) (g: 'U -> 'T) (source: '``InvariantFunctor<'T>``) = Invmap.Invoke f g source : '``InvariantFunctor<'U>`` - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // Category --------------------------------------------------------------- @@ -1315,7 +1315,7 @@ module Operators = let inline mapItem5 (mapping: 'T -> 'U) (tuple: '``('A * 'B * 'C * 'D * 'T * ..)``) = MapItem5.Invoke mapping tuple : '``('A * 'B * 'C * 'D * 'U * ..)`` - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // Converter @@ -1361,7 +1361,7 @@ module Operators = #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// /// Converts to a value from its string representation. @@ -1510,7 +1510,7 @@ module Operators = #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 // Additional functions @@ -1559,7 +1559,7 @@ module Operators = let dispose (resource: System.IDisposable) = match resource with null -> () | x -> x.Dispose () - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 /// Additional operators for Arrows related functions which shadows some F# operators for bitwise functions. module Arrows = diff --git a/src/FSharpPlus/Parsing.fs b/src/FSharpPlus/Parsing.fs index 32b08cb0e..392e5117e 100644 --- a/src/FSharpPlus/Parsing.fs +++ b/src/FSharpPlus/Parsing.fs @@ -1,6 +1,6 @@ namespace FSharpPlus -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 [] module Parsing = diff --git a/tests/FSharpPlusFable.Tests/FSharpPlusFable.Tests.fsproj b/tests/FSharpPlusFable.Tests/FSharpPlusFable.Tests.fsproj index b84021a05..5e3daf83c 100644 --- a/tests/FSharpPlusFable.Tests/FSharpPlusFable.Tests.fsproj +++ b/tests/FSharpPlusFable.Tests/FSharpPlusFable.Tests.fsproj @@ -7,6 +7,7 @@ 6.0 $(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_FAKE $(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_3;FABLE_COMPILER_FAKE + $(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_4;FABLE_COMPILER_FAKE net6.0 diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/Extensions.fs b/tests/FSharpPlusFable.Tests/FSharpTests/Extensions.fs index 57abc62dc..bc824536d 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/Extensions.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/Extensions.fs @@ -46,7 +46,7 @@ let ExtensionsTest = let r2 = m1 |> Map.unionWith konst m2 equalMap r1 r2) -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "Bind" (fun () -> let x = [1;2] >>= fun x -> [string x ; string (x + 1000) ] let y = { Head = 1; Tail = [2] } >>= fun x -> { Head = string x ; Tail = [string (x + 1000)] } diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General.fs index fe7e0757f..c23fc6b14 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General.fs @@ -158,7 +158,7 @@ let monadTransformers = testList "MonadTransformers" [ #endif ] -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 module ProfunctorDefaults = type Fun<'T,'U> = Fun of ('T -> 'U) with static member Dimap ((Fun f): Fun<'B,'C>, g: 'A->'B, h:'C->'D) = Fun (g >> f >> h) @@ -169,7 +169,7 @@ module ProfunctorDefaults = () #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 module BifunctorDefaults = type Tup<'a,'b> = Tup of ('a * 'b) with static member Bimap (Tup (a, b), f, g) = Tup (f a, g b) @@ -180,7 +180,7 @@ module BifunctorDefaults = () #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type StringCodec<'t> = StringCodec of ReaderT> * ('t -> Const) with static member Invmap (StringCodec (d, e), f: 'T -> 'U, g: 'U -> 'T) = StringCodec (map f d, contramap g e) module StringCodec = @@ -189,7 +189,7 @@ module StringCodec = #endif let invariant = testList "Invariant" [ -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "testStringToIntDerivedFromFloat" (fun () -> let floatCodec = StringCodec (ReaderT (tryParse >> Option.toResultWith "Parse error"), string >> Const) let floatParsed = StringCodec.decode floatCodec "1.8" @@ -234,7 +234,7 @@ let bitConverter = testList "BitConverter" [ let curry = testList "Curry" [ -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "curryTest" (fun () -> #if !FABLE_COMPILER @@ -270,7 +270,7 @@ let curry = testList "Curry" [ ()) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "uncurryTest" (fun () -> let g2 x y = [x + y] let g3 x y z = [x + y + z] diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Alternative.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Alternative.fs index aa5c35821..d1e72830c 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Alternative.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Alternative.fs @@ -8,7 +8,7 @@ open FSharpPlus.Data -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let testEmpty () = let _: WrappedListE = empty let _: list = empty @@ -21,7 +21,7 @@ let testEmpty () = () #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let testAppend () = let _ = WrappedListE [1;2] <|> WrappedListE [3;4] let _ = [1;2] <|> [3;4] @@ -35,7 +35,7 @@ let testAppend () = () #endif let alternative = testList "Alternative" [ -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "testEmptyAndAppendForCustomType" (fun () -> let u = WrappedListE [1;2] let v = WrappedListG [1;2] @@ -61,7 +61,7 @@ let alternative = testList "Alternative" [ Assert.AreEqual (Some 1, z)) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "testChoice" (fun () -> let s = seq { yield (SideEffects.add "a"; None) diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Applicative.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Applicative.fs index 996e3a337..807cde466 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Applicative.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Applicative.fs @@ -70,7 +70,7 @@ let applicative = testList "Applicative" [ Assert.IsInstanceOf> testGTE4) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "applicatives" (fun () -> let run (ZipList x) = x diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Collections.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Collections.fs index c3b89ca3a..03aa88fb5 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Collections.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Collections.fs @@ -14,7 +14,7 @@ module Collections = open System.Collections.Concurrent - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let testCollections = let bigSeq = seq {1..10000000} let bigLst = [ 1..10000000 ] @@ -39,7 +39,7 @@ module Collections = () #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let testSeqConversions = #if !FABLE_COMPILER let sk: Generic.Stack<_> = ofSeq { 1 .. 3 } @@ -125,7 +125,7 @@ module Collections = () #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let testListConversions = // From sequence diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Foldable.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Foldable.fs index 1cfb152ab..c8a13450b 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Foldable.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Foldable.fs @@ -9,7 +9,7 @@ open FSharpPlus.Data open System open System.Collections.ObjectModel -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let foldables = let _10 = foldBack (+) (seq [1;2;3;4]) 0 let _323 = toList (seq [3;2;3]) @@ -34,7 +34,7 @@ let foldable = testList "Foldable" [ SideEffects.are []) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "filterDefaultCustom" [ #if !FABLE_COMPILER testCase "WrappedListA" (fun () -> @@ -57,7 +57,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "foldAternatives" [ testCase "Option list" (fun () -> let x = choice [None; Some 3; Some 4; None] @@ -70,7 +70,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "fromToSeq" [ #if !FABLE_COMPILER testCase "dictionary" (fun () -> @@ -120,13 +120,13 @@ let foldable = testList "Foldable" [ Assert.IsInstanceOf>> (Some sortedSeq)) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "intersperse" (fun () -> equal "a,b,c,d,e" (intersperse ',' "abcde") equal ["a";",";"b";",";"c";",";"d";",";"e"] (intersperse "," ["a";"b";"c";"d";"e"])) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "intercalate" (fun () -> equal "Lorem, ipsum, dolor" (intercalate ", " ["Lorem"; "ipsum"; "dolor"])) #endif @@ -163,7 +163,7 @@ let foldable = testList "Foldable" [ equal 50 (foldMap ((+) 10) iReadOnlyList)) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "exists" (fun () -> SideEffects.reset () let _ = exists ((=) 2) [1..3] @@ -175,7 +175,7 @@ let foldable = testList "Foldable" [ ()) #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "pick" [ #if !FABLE_COMPILER testCase "StringBuilder" (fun () -> @@ -201,7 +201,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "minimum" [ testCase "list" (fun () -> let _ = minimum [1..3] @@ -225,7 +225,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "maxBy" [ testCase "list" (fun () -> let _ = maxBy id [1..3] @@ -249,7 +249,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "length" [ testCase "list" (fun () -> let _ = length [1..3] @@ -273,7 +273,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "tryHead" [ testCase "seq" (fun () -> let s = tryHead <| seq [1;2] @@ -306,7 +306,7 @@ let foldable = testList "Foldable" [ ] #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "tryLast" (fun () -> let s = tryLast <| seq [1;2] let s': int option = tryLast <| seq [] diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Functor.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Functor.fs index 0a8a58e14..60d20a4fd 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Functor.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Functor.fs @@ -34,7 +34,7 @@ let functor = testList "Functor" [ let tenEncoded = StringCodec.encode intCodec 10 equal oneParsed (Result.Ok 1) equal tenEncoded "10" ) - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "mapDefaultCustom" [ testCase "nelist" (fun () -> @@ -140,7 +140,7 @@ let functor = testList "Functor" [ ] #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "unzip" (fun () -> let testVal = unzip {Head = (1, 'a'); Tail = [(2, 'b');(3, 'b')]} #if !FABLE_COMPILER @@ -154,7 +154,7 @@ let functor = testList "Functor" [ Assert.AreEqual((NonEmptyMap.Create((1,(true)), (2, (false))),NonEmptyMap.Create((1,('a')), (2, ( 'b')))),testVal2)) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "zipTest" (fun () -> SideEffects.reset () @@ -239,7 +239,7 @@ let functor = testList "Functor" [ ()) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "genericZipShortest" (fun () -> let a = zip [|1; 2; 3|] [|"a"; "b"|] equalSeq [|1,"a"; 2,"b"|] a diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Indexable.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Indexable.fs index f9b439402..68c9fdd5d 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Indexable.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Indexable.fs @@ -11,7 +11,7 @@ open System.Collections.ObjectModel open FSharpPlus.Control let indexable = testList "Indexable" [ - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "testCompileAndExecuteItem" [ testCase "map" (fun () -> let a = Map.ofSeq [1, "one"; 2, "two"] @@ -68,7 +68,7 @@ let indexable = testList "Indexable" [ ] #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "testCompileAndExecuteTryItem" [ testCase "map" (fun () -> let a = Map.ofSeq [1, "one"; 2, "two"] @@ -228,7 +228,7 @@ let indexable = testList "Indexable" [ equalSeq ["Using WrappedMapA's TraverseIndexed"] (SideEffects.get ())) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "findIndexUsage" (fun () -> let m1 = WrappedListD [0..4] SideEffects.reset () @@ -237,7 +237,7 @@ let indexable = testList "Indexable" [ equal i1 2) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "findSliceIndexUsage" (fun () -> let m1 = WrappedListD [0..4] let m2 = WrappedListD [1..3] diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Lensing.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Lensing.fs index 41a32ee03..2f035d353 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Lensing.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Lensing.fs @@ -5,7 +5,7 @@ open Testing open FSharpPlus open FSharpPlus.Data open System -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 open FSharpPlus.Lens type Person = { Name: string; DateOfBirth: DateTime } module Person = @@ -20,7 +20,7 @@ let rayuela = DateOfBirth = DateTime (1914, 8, 26) } } #endif let lensing = testList "Lensing" [ -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "Lens" (fun () -> equal (view Book._authorName rayuela) "Julio Cortázar") testCase "Lens view 1, 2" (fun () -> diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Monad.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Monad.fs index 6c4d17296..3d5c5ec33 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Monad.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Monad.fs @@ -5,13 +5,13 @@ open FSharpPlus open FSharpPlus.Data #nowarn "686" -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let option<'t> = monad> let list<'t> = monad'> #endif let monad = testList "Monad" [ - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "joinDefaultCustom" (fun () -> let x = join [[1];[2]] equal [1;2] x @@ -23,7 +23,7 @@ let monad = testList "Monad" [ equal ["Join"] (SideEffects.get ())) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "workFlow" (fun () -> let testVal = monad { @@ -43,17 +43,18 @@ let monad = testList "Monad" [ equal None (cf |> Const.run |> First.run) ) #endif - + #if !FABLE_COMPILER_4 testCase "return Const First using explicit method" (fun () -> let cf : Const,int> = Const.Return<_,_> 1 equal None (cf |> Const.run |> First.run) ) + #endif #if !FABLE_COMPILER testCase "return Const" (fun () -> let c : Const = Control.Return.InvokeOnInstance 1 in equal 0 (Const.run c) ) #endif - + #if !FABLE_COMPILER_4 testCase "specialized maybe monad" (fun () -> let v = option { let! x = Some 10 @@ -71,6 +72,7 @@ let monad = testList "Monad" [ } equal [25] v ) + #endif // Exception: RangeError: Maximum call stack size exceeded #if !FABLE_COMPILER diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Monoid.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Monoid.fs index 4013c845d..b55907029 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Monoid.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Monoid.fs @@ -10,7 +10,7 @@ open FSharpPlus.Data open System.Threading.Tasks #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type ZipList<'s> = ZipList of 's seq with static member Return (x:'a) = ZipList (Seq.initInfinite (konst x)) static member Map (ZipList x, f: 'a->'b) = ZipList (Seq.map f x) @@ -44,7 +44,7 @@ let monoid = testList "Monoid" [ #if !FABLE_COMPILER let (WrappedListB x) = Seq.sum [WrappedListB [10]; WrappedListB [15]] #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 //equalSeq [10;15] x // fails to infer type? let (WrappedListC y) = Seq.sum [WrappedListC [10]; WrappedListC [15]] equalSeq [10] y @@ -71,7 +71,7 @@ let monoid = testList "Monoid" [ equal ["Using optimized Sum"] (SideEffects.get ()) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let _wl = WrappedListB [2..10] let _arrayGroup = groupBy ((%)/> 2) [|11;2;3;9;5;6;7;8;9;10|] diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/MonoidCompile.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/MonoidCompile.fs index c3cb17f2a..424b3c35e 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/MonoidCompile.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/MonoidCompile.fs @@ -10,7 +10,7 @@ open FSharpPlus.Data open System.Threading.Tasks #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type ZipList<'s> = ZipList of 's seq with static member Return (x:'a) = ZipList (Seq.initInfinite (konst x)) static member Map (ZipList x, f: 'a->'b) = ZipList (Seq.map f x) @@ -49,13 +49,13 @@ let testCompile = let _quot23 = plus (zero) <@ ResizeArray ([2;3]) @> let _quot13 = plus (zero) <@ ("1","3") @> #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let lzy1 = plus (lazy [1]) (lazy [2;3]) #endif #if !FABLE_COMPILER let _lzy = plus (zero) lzy1 #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let asy1 = plus (async.Return [1]) (async.Return [2;3]) #endif #if !FABLE_COMPILER @@ -64,7 +64,7 @@ let testCompile = let _bigNestedTuple2 = (1, System.Tuple (8, "ff",3,4,5,6,7,8,9,10,11,12,(),14,15,16,17,18,19,20)) ++ (zero, System.Tuple (8, "ff",3,4,5,6,7,8,9,10,11,12,(),14,15,16,17,18,19,20)) ++ zero #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let _nes : NonEmptySeq<_> = plus (NonEmptySeq.singleton 1) (NonEmptySeq.singleton 2) #endif diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Numeric.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Numeric.fs index a59077377..1f7fad674 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Numeric.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Numeric.fs @@ -7,7 +7,7 @@ open System.Collections.Generic open FSharpPlus.Data let numeric = testList "Numeric" [ - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "Zero First" (fun () -> let z : First = getZero() in equal None (First.run z)) #endif ] \ No newline at end of file diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Parsing.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Parsing.fs index 507a8190c..f9d545c73 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Parsing.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Parsing.fs @@ -6,7 +6,7 @@ open FSharpPlus.Data #nowarn "686" open System -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let (|Int32|_|) : _-> Int32 option = tryParse type ProductId = { Value:int } with @@ -17,7 +17,7 @@ with #endif let parsing = testList "Parsing" [ - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "parse" (fun () -> let v2 : DateTimeOffset = parse "2011-03-04T15:42:19+03:00" diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Splits.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Splits.fs index a6744faf5..fcddd4064 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Splits.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Splits.fs @@ -17,7 +17,7 @@ type Sum<'a> = Sum of 'a with let splits = testList "Splits" [ - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testCase "splitArraysAndStrings" (fun () -> let a1 = "this.isABa.tABCest" |> split [|"AT" ; "ABC" |] let a2 = "this.isABa.tABCest"B |> split [|"AT"B; "ABC"B|] diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Traversable.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Traversable.fs index a8dbe1dc7..5e5fc5b7c 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Traversable.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Traversable.fs @@ -7,7 +7,7 @@ open FSharpPlus.Data open System.Threading.Tasks -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type Either<'l,'r> = Left of 'l | Right of 'r with static member Return x = Right x static member inline get_Empty () = Left empty @@ -26,7 +26,7 @@ let traverseTest = let toOptions x = if x <> 4 then Some x else None let toChoices x = if x <> 4 then Choice1Of2 x else Choice2Of2 "This is a failure" let toLists x = if x <> 4 then [x; x] else [] -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 let toEithers x = if x <> 4 then Right x else Left ["This is a failure"] #endif @@ -85,7 +85,7 @@ let traversable = testList "Traversable" [ ()) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "traverse_Order" [ testCase "nelist" (fun () -> SideEffects.reset() @@ -191,7 +191,7 @@ let traversable = testList "Traversable" [ Assert.AreEqual (Either>.Left ["This is a failure"], e)) #endif - #if !FABLE_COMPILER || FABLE_COMPILER_3 + #if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 testList "traverseFiniteApplicatives" [ // TODO -> implement short-circuit without breaking anything else #if !FABLE_COMPILER diff --git a/tests/FSharpPlusFable.Tests/FSharpTests/General/Util.fs b/tests/FSharpPlusFable.Tests/FSharpTests/General/Util.fs index 95f499b84..a12f4f4ea 100644 --- a/tests/FSharpPlusFable.Tests/FSharpTests/General/Util.fs +++ b/tests/FSharpPlusFable.Tests/FSharpTests/General/Util.fs @@ -4,7 +4,7 @@ open FSharpPlus open FSharpPlus.Data open FSharpPlus.Control open Testing -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type WrappedMapA<'K,'V when 'K : comparison> = WrappedMapA of Map<'K,'V> with static member ToMap (WrappedMapA m) = m static member inline TraverseIndexed (WrappedMapA m, f) = @@ -42,7 +42,7 @@ type WrappedListA<'s> = WrappedListA of 's list with List.length lst #endif -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type WrappedListB<'s> = WrappedListB of 's list with static member Return x = WrappedListB [x] static member (+) (WrappedListB l, WrappedListB x) = WrappedListB (l @ x) @@ -63,7 +63,7 @@ type WrappedListC<'s> = WrappedListC of 's list with static member Zero = WrappedListC List.empty static member Sum (lst: seq>) = Seq.head lst -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type WrappedListD<'s> = WrappedListD of 's list with interface Collections.Generic.IEnumerable<'s> with member x.GetEnumerator () = (let (WrappedListD x) = x in x :> _ seq).GetEnumerator () interface Collections.IEnumerable with member x.GetEnumerator () = (let (WrappedListD x) = x in x :> _ seq).GetEnumerator () :> Collections.IEnumerator @@ -139,7 +139,7 @@ type WrappedListG<'s> = WrappedListG of 's list with static member Delay (f: unit -> WrappedListG<_>) = SideEffects.add "Using WrappedListG's Delay"; f () static member Using (resource, body) = SideEffects.add "Using WrappedListG's Using"; using resource body -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type WrappedListH<'s> = WrappedListH of 's list with static member Map (WrappedListH lst, f) = WrappedListH (List.map f lst) static member inline Sequence (x: WrappedListH<'``Functor<'T>``>) = @@ -200,7 +200,7 @@ type WrappedSeqC<'s> = WrappedSeqC of 's seq with SideEffects.add "Using WrappedSeqC's TryFinally" try computation finally compensation () -#if !FABLE_COMPILER || FABLE_COMPILER_3 +#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4 type WrappedSeqD<'s> = WrappedSeqD of 's seq with static member Return x = SideEffects.add "Using WrappedSeqD's Return"; WrappedSeqD (Seq.singleton x) static member (<*>) (WrappedSeqD f, WrappedSeqD x) = SideEffects.add "Using WrappedSeqD's Apply"; WrappedSeqD (f <*> x) diff --git a/tests/FSharpPlusFable.Tests/package.json b/tests/FSharpPlusFable.Tests/package.json index a2531bd1d..4572c8daf 100644 --- a/tests/FSharpPlusFable.Tests/package.json +++ b/tests/FSharpPlusFable.Tests/package.json @@ -2,7 +2,7 @@ "private": true, "type": "module", "scripts": { - "test": "dotnet fable . --outDir bin --runScript ./bin /d", + "test": "fable . --outDir bin --runScript ./bin /d", "test_debug": "node --eval \"require('esm')(module)('./bin/./Tests.js')\" ./bin/./Tests.js ./bin /d" }, "name": "tests"