Skip to content

Commit f211f8b

Browse files
committed
fix: use string types for open
1 parent eceae9b commit f211f8b

File tree

6 files changed

+145
-160
lines changed

6 files changed

+145
-160
lines changed

.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"isRoot": true,
44
"tools": {
55
"paket": {
6-
"version": "6.2.1",
6+
"version": "7.1.5",
77
"commands": [
88
"paket"
99
]
1010
},
1111
"fantomas-tool": {
12-
"version": "4.5.10",
12+
"version": "4.7.9",
1313
"commands": [
1414
"fantomas"
1515
]

src/stdlib/Ast.fs

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type _identifier = string
88

99

1010
type AST =
11-
abstract foo : int
11+
abstract foo: int
1212

1313
type ``mod`` =
1414
inherit AST
@@ -18,11 +18,11 @@ type expr =
1818

1919
type Module =
2020
inherit ``mod``
21-
abstract body : stmt array
21+
abstract body: stmt array
2222

2323
type Expression =
2424
inherit ``mod``
25-
abstract body : expr
25+
abstract body: expr
2626

2727
type stmt =
2828
inherit AST
@@ -31,74 +31,74 @@ type stmt =
3131
type FunctionDef =
3232
inherit stmt
3333

34-
abstract name : _identifier
35-
abstract args : arguments
36-
abstract body : stmt array
37-
abstract decorator_list : expr array
38-
abstract returns : expr option
34+
abstract name: _identifier
35+
abstract args: arguments
36+
abstract body: stmt array
37+
abstract decorator_list: expr array
38+
abstract returns: expr option
3939

4040
type ClassDef =
4141
inherit stmt
42-
abstract name : _identifier
43-
abstract bases : expr array
44-
abstract keywords : keyword array
45-
abstract body : stmt array
46-
abstract decorator_list : expr array
42+
abstract name: _identifier
43+
abstract bases: expr array
44+
abstract keywords: keyword array
45+
abstract body: stmt array
46+
abstract decorator_list: expr array
4747

4848
type Return =
4949
inherit stmt
50-
abstract value : expr option
50+
abstract value: expr option
5151

5252
type Delete =
5353
inherit stmt
54-
abstract targets : expr array
54+
abstract targets: expr array
5555

5656
type Assign =
5757
inherit stmt
58-
abstract targets : expr array
59-
abstract value : expr
58+
abstract targets: expr array
59+
abstract value: expr
6060

6161
type Import =
6262
inherit stmt
63-
abstract names : alias array
63+
abstract names: alias array
6464

6565
type ImportFrom =
6666
inherit stmt
67-
abstract ``module`` : _identifier option
68-
abstract names : alias array
69-
abstract level : int
67+
abstract ``module``: _identifier option
68+
abstract names: alias array
69+
abstract level: int
7070

7171
type If =
7272
inherit stmt
73-
abstract test : expr
74-
abstract body : stmt array
75-
abstract orelse : stmt array
73+
abstract test: expr
74+
abstract body: stmt array
75+
abstract orelse: stmt array
7676

7777
type arguments =
7878
inherit AST
7979

80-
abstract posonlyargs : arg array
81-
abstract args : arg array
82-
abstract vararg : arg option
83-
abstract kwonlyargs : arg array
84-
abstract kw_defaults : expr option list
85-
abstract kwarg : arg option
86-
abstract defaults : expr array
80+
abstract posonlyargs: arg array
81+
abstract args: arg array
82+
abstract vararg: arg option
83+
abstract kwonlyargs: arg array
84+
abstract kw_defaults: expr option list
85+
abstract kwarg: arg option
86+
abstract defaults: expr array
8787

8888
type arg =
8989
inherit AST
90-
abstract arg : _identifier
91-
abstract annotation : expr option
90+
abstract arg: _identifier
91+
abstract annotation: expr option
9292

9393
type keyword =
9494
inherit AST
95-
abstract arg : _identifier option
96-
abstract value : expr
95+
abstract arg: _identifier option
96+
abstract value: expr
9797

9898
type alias =
9999
inherit AST
100-
abstract name : _identifier
101-
abstract asname : _identifier option
100+
abstract name: _identifier
101+
abstract asname: _identifier option
102102

103103

104104
[<StringEnum>]
@@ -108,17 +108,17 @@ type Mode =
108108

109109
type IExports =
110110
/// Parse the source into an AST node
111-
abstract parse : string -> AST
112-
abstract parse : string * filename: string -> AST
113-
abstract parse : string * filename: string * mode: Mode -> AST
114-
abstract unparse : astObj: AST -> string
115-
abstract walk : node: AST -> AST array
111+
abstract parse: string -> AST
112+
abstract parse: string * filename: string -> AST
113+
abstract parse: string * filename: string * mode: Mode -> AST
114+
abstract unparse: astObj: AST -> string
115+
abstract walk: node: AST -> AST array
116116
/// Return a formatted dump of the tree in node.
117-
abstract dump : node: AST -> string
117+
abstract dump: node: AST -> string
118118
/// Return a formatted dump of the tree in node.
119-
abstract dump : node: AST * annotate_fields: bool -> string
119+
abstract dump: node: AST * annotate_fields: bool -> string
120120
/// Return a formatted dump of the tree in node.
121-
abstract dump : node: AST * annotate_fields: bool * include_attributes: bool -> string
121+
abstract dump: node: AST * annotate_fields: bool * include_attributes: bool -> string
122122

123123
[<ImportAll("ast")>]
124124
let ast: IExports = nativeOnly

src/stdlib/Builtins.fs

Lines changed: 49 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -15,70 +15,54 @@ type TextIOWrapper =
1515
inherit IDisposable
1616
inherit TextIOBase
1717

18-
[<StringEnum>]
19-
type OpenTextModeUpdating =
20-
| [<CompiledName("r+")>] ReadUpdate
21-
| [<CompiledName("+r")>] UpdateRead
22-
| [<CompiledName("rt+")>] ReadTextUpdate
23-
| [<CompiledName("r+t")>] ReadUpdateText
24-
| [<CompiledName("+rt")>] UpdateReadText
25-
| [<CompiledName("tr+")>] TextReadUpdate
26-
| [<CompiledName("t+r")>] TextUpdateRead
27-
| [<CompiledName("+tr")>] UpdateTextRead
28-
| [<CompiledName("w+")>] WriteUpdate
29-
| [<CompiledName("+w")>] UpdateWrite
30-
| [<CompiledName("wt+")>] WriteTextUpdate
31-
| [<CompiledName("w+t")>] WriteUpdateText
32-
| [<CompiledName("+wt")>] UpdateWriteText
33-
| [<CompiledName("tw+")>] TextWriteUpdate
34-
| [<CompiledName("t+w")>] TextUpdateWrite
35-
| [<CompiledName("+tw")>] UpdateTextWrite
36-
| [<CompiledName("a+")>] AppendUpdate
37-
| [<CompiledName("+a")>] UpdateAppend
38-
| [<CompiledName("at+")>] AppendTextUpdate
39-
| [<CompiledName("a+t")>] AppendUpdateText
40-
| [<CompiledName("+at")>] UpdateAppendText
41-
| [<CompiledName("ta+")>] TextAppendUpdate
42-
| [<CompiledName("t+a")>] TextUpdateAppend
43-
| [<CompiledName("+ta")>] UpdateTextAppend
44-
| [<CompiledName("x+")>] CreateUpdate
45-
| [<CompiledName("+x")>] UpdateCreate
46-
| [<CompiledName("xt+")>] CreateTextUpdate
47-
| [<CompiledName("x+t")>] CreateUpdateText
48-
| [<CompiledName("+xt")>] UpdateCreateText
49-
| [<CompiledName("tx+")>] TextCreateUpdate
50-
| [<CompiledName("t+x")>] TextUpdateCreate
51-
| [<CompiledName("+tx")>] UpdateTextCreate
18+
module OpenTextMode =
19+
let [<Literal>] ReadUpdate = "r+"
20+
let [<Literal>] UpdateRead = "+r"
21+
let [<Literal>] ReadTextUpdate = "rt+"
22+
let [<Literal>] ReadUpdateText = "r+t"
23+
let [<Literal>] UpdateReadText = "+rt"
24+
let [<Literal>] TextReadUpdate = "tr+"
25+
let [<Literal>] TextUpdateRead = "t+r"
26+
let [<Literal>] UpdateTextRead = "+tr"
27+
let [<Literal>] WriteUpdate = "w+"
28+
let [<Literal>] UpdateWrite = "+w"
29+
let [<Literal>] WriteTextUpdate = "wt+"
30+
let [<Literal>] WriteUpdateText = "w+t"
31+
let [<Literal>] UpdateWriteText = "+wt"
32+
let [<Literal>] TextWriteUpdate = "tw+"
33+
let [<Literal>] TextUpdateWrite = "t+w"
34+
let [<Literal>] UpdateTextWrite = "+tw"
35+
let [<Literal>] AppendUpdate = "a+"
36+
let [<Literal>] UpdateAppend = "+a"
37+
let [<Literal>] AppendTextUpdate = "at+"
38+
let [<Literal>] AppendUpdateText = "a+t"
39+
let [<Literal>] UpdateAppendText = "+at"
40+
let [<Literal>] TextAppendUpdate = "ta+"
41+
let [<Literal>] TextUpdateAppend = "t+a"
42+
let [<Literal>] UpdateTextAppend = "+ta"
43+
let [<Literal>] CreateUpdate = "x+"
44+
let [<Literal>] UpdateCreate = "+x"
45+
let [<Literal>] CreateTextUpdate = "xt+"
46+
let [<Literal>] CreateUpdateText = "x+t"
47+
let [<Literal>] UpdateCreateText = "+xt"
48+
let [<Literal>] TextCreateUpdate = "tx+"
49+
let [<Literal>] TextUpdateCreate = "t+x"
50+
let [<Literal>] UpdateTextCreate = "+tx"
51+
52+
let [<Literal>] Read = "rt"
53+
let [<Literal>] ReadText = "rt"
54+
let [<Literal>] TextRead = "tr"
55+
56+
let [<Literal>] Write = "w"
57+
let [<Literal>] WriteText = "wt"
58+
let [<Literal>] TextWrite = "tw"
59+
let [<Literal>] Append = "a"
60+
let [<Literal>] AppendText = "at"
61+
let [<Literal>] TextAppend = "ta"
62+
let [<Literal>] Create = "x"
63+
let [<Literal>] CreateText = "xt"
64+
let [<Literal>] TextCreate = "tx"
5265

53-
[<StringEnum>]
54-
type OpenTextModeReading =
55-
| [<CompiledName("rt")>] Read
56-
| [<CompiledName("rt")>] ReadText
57-
| [<CompiledName("tr")>] TextRead
58-
59-
[<StringEnum>]
60-
type OpenTextModeWriting =
61-
| [<CompiledName("w")>] Write
62-
| [<CompiledName("wt")>] WriteText
63-
| [<CompiledName("tw")>] TextWrite
64-
| [<CompiledName("a")>] Append
65-
| [<CompiledName("at")>] AppendText
66-
| [<CompiledName("ta")>] TextAppend
67-
| [<CompiledName("x")>] Create
68-
| [<CompiledName("xt")>] CreateText
69-
| [<CompiledName("tx")>] TextCreate
70-
71-
[<Erase>]
72-
type OpenTextMode =
73-
| OpenTextModeUpdating
74-
| OpenTextModeWriting
75-
| OpenTextModeReading
76-
77-
78-
[<Erase>]
79-
type _OpenFile =
80-
| StringPath of string
81-
| FileDescriptor of int
8266

8367
type _Opener = Tuple<string, int> -> int
8468

@@ -120,7 +104,8 @@ type IExports =
120104
abstract float : obj -> float
121105
abstract print : obj: obj -> unit
122106

123-
[<NamedParams(fromIndex=1)>] abstract ``open`` : file: _OpenFile * ?mode: OpenTextMode * ?buffering: int * ?encoding: string * ?errors: string * ?newline: string * ?closefd: bool * ?opener: _Opener -> TextIOWrapper
107+
[<NamedParams(fromIndex=1)>] abstract ``open`` : file: int * ?mode: string * ?buffering: int * ?encoding: string * ?errors: string * ?newline: string * ?closefd: bool * ?opener: _Opener -> TextIOWrapper
108+
[<NamedParams(fromIndex=1)>] abstract ``open`` : file: string * ?mode: string * ?buffering: int * ?encoding: string * ?errors: string * ?newline: string * ?closefd: bool * ?opener: _Opener -> TextIOWrapper
124109

125110
[<ImportAll("builtins")>]
126111
let builtins: IExports = nativeOnly

src/stdlib/Json.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ open Fable.Core
55
// fsharplint:disable MemberNames
66

77
type IExports =
8-
abstract dumps : obj: obj -> string
9-
abstract loads : string -> obj
8+
abstract dumps: obj: obj -> string
9+
abstract loads: string -> obj
1010

1111
[<ImportAll("json")>]
1212
let json: IExports = nativeOnly

0 commit comments

Comments
 (0)