diff --git a/src/Bolero.Html/Builders.fs b/src/Bolero.Html/Builders.fs
index 99ff0764..53b67203 100644
--- a/src/Bolero.Html/Builders.fs
+++ b/src/Bolero.Html/Builders.fs
@@ -44,7 +44,7 @@ type ChildContentAttr = delegate of receiver: obj * builder: RenderTreeBuilder *
/// The containing component.
/// The rendering builder.
/// The rendering sequence number.
-type ChildAndRefContent = delegate of receiver: obj * builder: Rendering.RenderTreeBuilder * sequence: int -> int
+type ChildAndRefContent = delegate of receiver: obj * builder: RenderTreeBuilder * sequence: int -> int
type [] AttrBuilder =
member inline _.Yield([] attr: Attr) = attr
diff --git a/src/Bolero.Server/Components.fs b/src/Bolero.Server/Components.fs
index 3d30f48a..b3f955a4 100644
--- a/src/Bolero.Server/Components.fs
+++ b/src/Bolero.Server/Components.fs
@@ -31,7 +31,6 @@ open System.Threading.Tasks
open Microsoft.AspNetCore.Components
#if NET8_0
open Microsoft.AspNetCore.Components.Endpoints
-open Microsoft.AspNetCore.Components.Web
#endif
open Microsoft.AspNetCore.Components.RenderTree
open Microsoft.AspNetCore.Components.Rendering
diff --git a/src/Bolero.Server/Extensions.fs b/src/Bolero.Server/Extensions.fs
index 45290f00..dd5d7ed1 100644
--- a/src/Bolero.Server/Extensions.fs
+++ b/src/Bolero.Server/Extensions.fs
@@ -80,7 +80,7 @@ type ServerComponentsExtensions =
/// The page to return.
[]
static member BoleroPage(_this: Controller, page: Node) =
- new BoleroPageResult(page)
+ BoleroPageResult(page)
/// Render the JavaScript tag needed by Bolero in a Razor page.
/// The injected Bolero hosting configuration.
diff --git a/src/Bolero.Server/Remoting/Endpoints.fs b/src/Bolero.Server/Remoting/Endpoints.fs
index e7dbf427..fe3db857 100644
--- a/src/Bolero.Server/Remoting/Endpoints.fs
+++ b/src/Bolero.Server/Remoting/Endpoints.fs
@@ -182,8 +182,8 @@ type internal RemotingEndpointDataSource() =
override _.Endpoints =
endpointBuilders
- |> Seq.collect (fun b -> b.ApplyFinally())
- |> Seq.map (fun b -> b.Build())
+ |> Seq.collect _.ApplyFinally()
+ |> Seq.map _.Build()
|> Array.ofSeq
:> IReadOnlyList
diff --git a/src/Bolero.Templating.Provider/CodeGen.fs b/src/Bolero.Templating.Provider/CodeGen.fs
index 8d69d6cf..14c3e8dc 100644
--- a/src/Bolero.Templating.Provider/CodeGen.fs
+++ b/src/Bolero.Templating.Provider/CodeGen.fs
@@ -31,97 +31,97 @@ open Bolero.TemplatingInternals
open Bolero.Templating.ConvertExpr
let getThis (args: list) : Expr =
- TExpr.Coerce(args.[0])
+ TExpr.Coerce(args[0])
let MakeCtor (holes: Parsing.Vars) =
ProvidedConstructor([], fun args ->
let holes = TExpr.Array [
for KeyValue(_, type') in holes ->
match type' with
- | Parsing.HoleType.String -> <@ box "" @>
- | Parsing.HoleType.Html -> <@ box (Node.Empty()) @>
- | Parsing.HoleType.Event _ -> <@ box (Events.NoOp()) @>
- | Parsing.HoleType.DataBinding _ -> <@ box (null, Events.NoOp()) @>
- | Parsing.HoleType.Attribute -> <@ box (Attr.Empty()) @>
- | Parsing.HoleType.AttributeValue -> <@ null @>
- | Parsing.HoleType.Ref -> <@ null @>
+ | HoleType.String -> <@ box "" @>
+ | HoleType.Html -> <@ box (Node.Empty()) @>
+ | HoleType.Event _ -> <@ box (Events.NoOp()) @>
+ | HoleType.DataBinding _ -> <@ box (null, Events.NoOp()) @>
+ | HoleType.Attribute -> <@ box (Attr.Empty()) @>
+ | HoleType.AttributeValue -> <@ null @>
+ | HoleType.Ref -> <@ null @>
]
<@@ (%getThis args).Holes <- %holes @@>)
/// Get the argument lists and bodies for methods that fill a hole of the given type.
-let HoleMethodBodies (holeType: Parsing.HoleType) : (ProvidedParameter list * (Expr list -> Expr)) list =
+let HoleMethodBodies (holeType: HoleType) : (ProvidedParameter list * (Expr list -> Expr)) list =
let (=>) name ty = ProvidedParameter(name, ty)
match holeType with
- | Parsing.HoleType.String ->
+ | HoleType.String ->
[
["value" => typeof], fun args ->
- <@@ box (%%args.[1]: string) @@>
+ <@@ box (%%args[1]: string) @@>
]
- | Parsing.HoleType.Html ->
+ | HoleType.Html ->
[
["value" => typeof], fun args ->
- <@@ box (Node.Text (%%args.[1]: string)) @@>
+ <@@ box (Node.Text (%%args[1]: string)) @@>
["value" => typeof], fun args ->
- <@@ box (%%args.[1]: Node) @@>
+ <@@ box (%%args[1]: Node) @@>
]
- | Parsing.HoleType.Event argTy ->
+ | HoleType.Event argTy ->
[
["value" => EventHandlerOf argTy], fun args ->
- Expr.Coerce(args.[1], typeof)
+ Expr.Coerce(args[1], typeof)
]
- | Parsing.HoleType.DataBinding Parsing.BindingType.BindString ->
+ | HoleType.DataBinding BindingType.BindString ->
[
["value" => typeof; "set" => typeof>], fun args ->
- <@@ box (box (%%args.[1]: string), Events.OnChange(%%args.[2])) @@>
+ <@@ box (box (%%args[1]: string), Events.OnChange(%%args[2])) @@>
]
- | Parsing.HoleType.DataBinding Parsing.BindingType.BindNumber ->
+ | HoleType.DataBinding BindingType.BindNumber ->
[
["value" => typeof; "set" => typeof>], fun args ->
- <@@ box (box (%%args.[1]: int), Events.OnChangeInt(%%args.[2])) @@>
+ <@@ box (box (%%args[1]: int), Events.OnChangeInt(%%args[2])) @@>
["value" => typeof; "set" => typeof>], fun args ->
- <@@ box (box (%%args.[1]: float), Events.OnChangeFloat(%%args.[2])) @@>
+ <@@ box (box (%%args[1]: float), Events.OnChangeFloat(%%args[2])) @@>
]
- | Parsing.HoleType.DataBinding Parsing.BindingType.BindBool ->
+ | HoleType.DataBinding BindingType.BindBool ->
[
["value" => typeof; "set" => typeof>], fun args ->
- <@@ box (box (%%args.[1]: bool), Events.OnChangeBool(%%args.[2])) @@>
+ <@@ box (box (%%args[1]: bool), Events.OnChangeBool(%%args[2])) @@>
]
- | Parsing.HoleType.Attribute ->
+ | HoleType.Attribute ->
[
["value" => typeof], fun args ->
- <@@ box (%%args.[1]: Attr) @@>
+ <@@ box (%%args[1]: Attr) @@>
["value" => typeof>], fun args ->
- <@@ box (Attr.Attrs(%%args.[1]: list)) @@>
+ <@@ box (Attr.Attrs(%%args[1]: list)) @@>
]
- | Parsing.HoleType.AttributeValue ->
+ | HoleType.AttributeValue ->
[
["value" => typeof], fun args ->
- <@@ %%args.[1] @@>
+ <@@ %%args[1] @@>
]
- | Parsing.HoleType.Ref ->
+ | HoleType.Ref ->
[
["value" => typeof], fun args ->
- <@@ box (%%args.[1]: HtmlRef) @@>
+ <@@ box (%%args[1]: HtmlRef) @@>
]
-let MakeHoleMethods (holeName: string) (holeType: Parsing.HoleType) (index: int) (containerTy: ProvidedTypeDefinition) =
+let MakeHoleMethods (holeName: string) (holeType: HoleType) (index: int) (containerTy: ProvidedTypeDefinition) =
[
for args, value in HoleMethodBodies holeType do
yield ProvidedMethod(holeName, args, containerTy, fun args ->
let this = getThis args
- <@@ (%this).Holes.[index] <- %%(value args)
+ <@@ (%this).Holes[index] <- %%(value args)
%this @@>) :> MemberInfo
]
-let MakeFinalMethod (filename: option) (subTemplateName: option) (content: Parsing.Parsed) =
+let MakeFinalMethod (filename: option) (subTemplateName: option) (content: Parsed) =
ProvidedMethod("Elt", [], typeof, fun args ->
let this = getThis args
let directExpr =
let vars = content.Vars |> Map.map (fun k v -> Var(k, TypeOf v))
let varExprs = vars |> Map.map (fun _ v -> Expr.Var v)
- ((0, ConvertNode varExprs (Parsing.Concat content.Expr) :> Expr), vars)
+ ((0, ConvertNode varExprs (Concat content.Expr) :> Expr), vars)
||> Seq.fold (fun (i, e) (KeyValue(_, var)) ->
- let value = <@@ (%this).Holes.[i] @@>
+ let value = <@@ (%this).Holes[i] @@>
let value = Expr.Coerce(value, var.Type)
i + 1, Expr.Let(var, value, e)
)
diff --git a/src/Bolero.Templating.Provider/ConvertExpr.fs b/src/Bolero.Templating.Provider/ConvertExpr.fs
index 1452b06b..6b50a0e1 100644
--- a/src/Bolero.Templating.Provider/ConvertExpr.fs
+++ b/src/Bolero.Templating.Provider/ConvertExpr.fs
@@ -67,7 +67,7 @@ let WrapExpr (innerType: Parsing.HoleType) (outerType: Parsing.HoleType) (expr:
/// Map an expression's vars from its parent, wrapping the expression in let declarations.
let WrapAndConvert (vars: Map) (subst: list) convert expr =
let vars, addLets = ((vars, id), subst) ||> List.fold (fun (vars, addLets) wrap ->
- let unwrapped = vars.[wrap.name]
+ let unwrapped = vars[wrap.name]
let wrapped = WrapExpr wrap.innerType wrap.outerType unwrapped
let var = Var(wrap.name, TypeOf wrap.innerType)
let addLets e = Expr.Let(var, defaultArg wrapped unwrapped, addLets e) |> Expr.Cast
@@ -84,7 +84,7 @@ let rec ConvertAttrTextPart (vars: Map) (text: Parsing.Expr) : Exp
| Parsing.PlainHtml text ->
<@ text @>
| Parsing.VarContent varName ->
- let e : Expr = Expr.Coerce(vars.[varName], typeof) |> Expr.Cast
+ let e : Expr = Expr.Coerce(vars[varName], typeof) |> Expr.Cast
<@ (%e).ToString() @>
| Parsing.WrapVars (subst, text) ->
WrapAndConvert vars subst ConvertAttrTextPart text
@@ -100,11 +100,11 @@ let rec ConvertAttrValue (vars: Map) (text: Parsing.Expr) : Expr
box <@ text @>
| Parsing.VarContent varName ->
- box vars.[varName]
+ box vars[varName]
| Parsing.Fst varName ->
- box (Expr.TupleGet(vars.[varName], 0))
+ box (Expr.TupleGet(vars[varName], 0))
| Parsing.Snd varName ->
- box (Expr.TupleGet(vars.[varName], 1))
+ box (Expr.TupleGet(vars[varName], 1))
| Parsing.WrapVars (subst, text) ->
WrapAndConvert vars subst ConvertAttrValue text
| Parsing.Attr _ | Parsing.Elt _ | Parsing.HtmlRef _ ->
@@ -119,11 +119,11 @@ let rec ConvertAttr (vars: Map) (attr: Parsing.Expr) : Expr
let value = ConvertAttrValue vars value
<@ Attr.Make name %value @>
| Parsing.VarContent varName ->
- vars.[varName] |> Expr.Cast
+ vars[varName] |> Expr.Cast
| Parsing.WrapVars (subst, attr) ->
WrapAndConvert vars subst ConvertAttr attr
| Parsing.HtmlRef varName ->
- let ref = vars.[varName] |> Expr.Cast
+ let ref = vars[varName] |> Expr.Cast
<@ Ref.MakeAttr(%ref) @>
| Parsing.Fst _ | Parsing.Snd _ | Parsing.PlainHtml _ | Parsing.Elt _ ->
failwith $"Invalid attribute: {attr}"
@@ -144,7 +144,7 @@ let rec ConvertNode (vars: Map) (node: Parsing.Expr) : Expr
let children = TExpr.Array (Seq.map (ConvertNode vars) children)
<@ Node.Elt name %attrs %children @>
| Parsing.VarContent varName ->
- vars.[varName] |> Expr.Cast
+ vars[varName] |> Expr.Cast
| Parsing.WrapVars (subst, node) ->
WrapAndConvert vars subst ConvertNode node
| Parsing.Fst _ | Parsing.Snd _ | Parsing.Attr _ | Parsing.HtmlRef _ ->
diff --git a/src/Bolero.Templating.Provider/Parsing.fs b/src/Bolero.Templating.Provider/Parsing.fs
index 8f48a859..af07cb4c 100644
--- a/src/Bolero.Templating.Provider/Parsing.fs
+++ b/src/Bolero.Templating.Provider/Parsing.fs
@@ -239,14 +239,14 @@ let ParseText (t: string) (varType: HoleType) : Parsed =
let mutable vars = Map.empty
for p in parse do
if p.Index > lastHoleEnd then
- parts.Add(PlainHtml t.[lastHoleEnd..p.Index - 1])
- let varName = p.Groups.[1].Value
+ parts.Add(PlainHtml t[lastHoleEnd..p.Index - 1])
+ let varName = p.Groups[1].Value
if not (Map.containsKey varName vars) then
vars <- Map.add varName varType vars
parts.Add(VarContent varName)
lastHoleEnd <- p.Index + p.Length
if lastHoleEnd < t.Length then
- parts.Add(PlainHtml t.[lastHoleEnd..t.Length - 1])
+ parts.Add(PlainHtml t[lastHoleEnd..t.Length - 1])
WithVars vars (parts.ToArray() |> List.ofSeq)
/// None if this is not a data binding.
diff --git a/src/Bolero.Templating.Provider/Path.fs b/src/Bolero.Templating.Provider/Path.fs
index 97e57f5a..9fa955a9 100644
--- a/src/Bolero.Templating.Provider/Path.fs
+++ b/src/Bolero.Templating.Provider/Path.fs
@@ -33,7 +33,7 @@ let Canonicalize (path: string) =
let GetRelativePath (baseDir: string) (fullPath: string) =
let rec go (thisDir: string) =
if thisDir = baseDir then
- fullPath.[thisDir.Length + 1..]
+ fullPath[thisDir.Length + 1..]
elif thisDir.Length <= baseDir.Length then
invalidArg "fullPath" $"'{fullPath}' is not a subdirectory of '{baseDir}'"
else
diff --git a/src/Bolero/Router.fs b/src/Bolero/Router.fs
index 883c0d12..81ab576b 100644
--- a/src/Bolero/Router.fs
+++ b/src/Bolero/Router.fs
@@ -197,7 +197,7 @@ type PageModel<'T> =
prop.SetValue(this, value)
#else
member internal this.SetModel(value) =
- (Unsafe.AsRef<'T>(&this.Model)) <- value
+ Unsafe.AsRef<'T>(&this.Model) <- value
#endif
[]
@@ -299,7 +299,7 @@ module private RouterImpl =
if getTag x = 0 then
None
else
- s.write (someDector x).[0]
+ s.write <| (someDector x)[0]
}, ValueSome none
| false, _ -> fail (InvalidRouterKind.UnsupportedType ty)
else
diff --git a/tests/Client/Main.fs b/tests/Client/Main.fs
index ef3cf371..9f7cb7be 100644
--- a/tests/Client/Main.fs
+++ b/tests/Client/Main.fs
@@ -347,7 +347,7 @@ let view js model dispatch =
cond model.page <| function
| Form -> viewForm js model dispatch
| Collection -> viewCollection model dispatch
- | Item (k, m) -> ecomp (k, model.items.[k], m.Model) dispatch { attr.empty() }
+ | Item (k, m) -> ecomp (k, model.items[k], m.Model) dispatch { attr.empty() }
| Lazy (x, y) -> viewLazy (x, y) model dispatch
| Virtual -> viewVirtual model dispatch
| NotFound -> p { text "Not found" }
diff --git a/tests/Remoting.Client/Main.fs b/tests/Remoting.Client/Main.fs
index d2a4cae3..feb56a23 100644
--- a/tests/Remoting.Client/Main.fs
+++ b/tests/Remoting.Client/Main.fs
@@ -138,7 +138,7 @@ let Update (myApi: MyApi) msg model =
let router : Router =
{
- getEndPoint = fun m -> m.page
+ getEndPoint = _.page
getRoute = function
| Home -> "/"
| Custom i -> $"/custom/{i}"
@@ -157,7 +157,7 @@ type Form = Template<"subdir/form.html">
type Item() =
inherit ElmishComponent, Message>()
- override __.View (KeyValue (k, v)) dispatch =
+ override _.View (KeyValue (k, v)) dispatch =
Tpl.item().key(string k).value(v)
.remove(fun _ -> dispatch (RemoveItem k))
.Elt()
diff --git a/tests/Remoting.Server/Startup.fs b/tests/Remoting.Server/Startup.fs
index f3cb1335..d08c2111 100644
--- a/tests/Remoting.Server/Startup.fs
+++ b/tests/Remoting.Server/Startup.fs
@@ -27,8 +27,6 @@ open Microsoft.AspNetCore
open Microsoft.AspNetCore.Authentication.Cookies
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
-open Microsoft.AspNetCore.Http
-open Microsoft.AspNetCore.Mvc
open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.Logging
@@ -47,14 +45,14 @@ module Page =
``base`` { attr.href "/" }
}
body {
- div { attr.id "main"; comp }
+ div { attr.id "main"; comp }
script { attr.src "_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js" }
boleroScript
}
}
type MyApiHandler(log: ILogger, ctx: IRemoteContext) =
- inherit RemoteHandler()
+ inherit RemoteHandler()
let mutable items = Map.empty
@@ -105,7 +103,7 @@ type Startup() =
services.AddSwaggerForSystemTextJson(JsonFSharpOptions()) |> ignore
services.AddEndpointsApiExplorer() |> ignore
- member this.Configure(app: IApplicationBuilder, env: IHostEnvironment, log: ILogger) =
+ member this.Configure(app: IApplicationBuilder, env: IHostEnvironment) =
app.UseAuthentication()
.UseStaticFiles()
.UseSwagger()
diff --git a/tests/Unit.Client/Html.fs b/tests/Unit.Client/Html.fs
index f2b99ef1..9924d411 100644
--- a/tests/Unit.Client/Html.fs
+++ b/tests/Unit.Client/Html.fs
@@ -77,7 +77,7 @@ type BoleroComponent() =
condUnionState <-
match s.Length with
| 0 -> Empty
- | 1 -> OneChar s.[0]
+ | 1 -> OneChar s[0]
| _ -> ManyChars s)
}
cond condUnionState <| function
diff --git a/tests/Unit/Fixture.fs b/tests/Unit/Fixture.fs
index e5f037ba..27765298 100644
--- a/tests/Unit/Fixture.fs
+++ b/tests/Unit/Fixture.fs
@@ -31,7 +31,6 @@ open OpenQA.Selenium.Chrome
// open OpenQA.Selenium.Firefox
open OpenQA.Selenium.Support.UI
open Swensen.Unquote
-open Bolero.Tests
/// Defines the setup/teardown for all tests that use the web server and Selenium.
/// These web tests must be located in the namespace Bolero.Tests.Web
diff --git a/tests/Unit/Tests/Routing.fs b/tests/Unit/Tests/Routing.fs
index 3b2ae507..b48540e0 100644
--- a/tests/Unit/Tests/Routing.fs
+++ b/tests/Unit/Tests/Routing.fs
@@ -1,7 +1,6 @@
namespace Bolero.Tests.Web
open System.Text.RegularExpressions
-open System.Threading
open FSharp.Reflection
open NUnit.Framework
open OpenQA.Selenium
@@ -88,19 +87,19 @@ module Routing =
let failingRouters = [
failingRouter<``Invalid parameter syntax``> <| fun c ->
- InvalidRouterKind.ParameterSyntax(c.[0], "{x")
+ InvalidRouterKind.ParameterSyntax(c[0], "{x")
failingRouter<``Unknown parameter name``> <| fun c ->
- InvalidRouterKind.UnknownField(c.[0], "y")
+ InvalidRouterKind.UnknownField(c[0], "y")
failingRouter<``Duplicate field``> <| fun c ->
- InvalidRouterKind.DuplicateField(c.[0], "x")
+ InvalidRouterKind.DuplicateField(c[0], "x")
failingRouter<``Incomplete parameter list``> <| fun c ->
- InvalidRouterKind.MissingField(c.[0], "y")
+ InvalidRouterKind.MissingField(c[0], "y")
failingRouter<``Identical paths with different parameter names``> <| fun c ->
- InvalidRouterKind.IdenticalPath(c.[1], c.[0])
+ InvalidRouterKind.IdenticalPath(c[1], c[0])
failingRouter<``Mismatched type parameters in same position``> <| fun c ->
- InvalidRouterKind.ParameterTypeMismatch(c.[1], "y", c.[0], "x")
+ InvalidRouterKind.ParameterTypeMismatch(c[1], "y", c[0], "x")
failingRouter<``Rest parameter in non-final position``> <| fun c ->
- InvalidRouterKind.RestNotLast(c.[0])
+ InvalidRouterKind.RestNotLast(c[0])
failingRouter> <| fun _ ->
InvalidRouterKind.UnsupportedType typeof>
]
diff --git a/tests/Unit/Tests/Templating.fs b/tests/Unit/Tests/Templating.fs
index 4fcfb8c2..e038285d 100644
--- a/tests/Unit/Tests/Templating.fs
+++ b/tests/Unit/Tests/Templating.fs
@@ -96,7 +96,7 @@ module Templating =
Double.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, ref 0.)
let isValidPosition (pos: string) =
let a = pos.Split(',')
- isNumber a.[0] && isNumber a.[1]
+ isNumber a[0] && isNumber a[1]
elt.ByClass("btn1").Click()
elt.Eventually <@ state.Text = "clicked 1" @>
diff --git a/tests/Unit/Utility.fs b/tests/Unit/Utility.fs
index 61934e41..d74cfafe 100644
--- a/tests/Unit/Utility.fs
+++ b/tests/Unit/Utility.fs
@@ -45,18 +45,18 @@ module Utility =
type ArbitraryModifiers =
static member Alphanum() =
{ new Arbitrary() with
- override __.Generator =
+ override _.Generator =
Gen.oneof [
Gen.choose(0, 25) |> Gen.map (fun i -> char (int 'a' + i))
Gen.choose(0, 25) |> Gen.map (fun i -> char (int 'A' + i))
Gen.choose(0, 9) |> Gen.map (fun i -> char (int '0' + i))
]
|> Gen.arrayOf
- override __.Shrinker x =
+ override _.Shrinker x =
if Array.isEmpty x then
Seq.empty
else
- Seq.singleton x.[1..]
+ Seq.singleton x[1..]
}
|> Arb.convert
(String >> Alphanum)