Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59372da

Browse files
committed
Merge remote-tracking branch 'upstream/master' into merges/master-to-dev16.0
2 parents24b8c0c +f3d55f2 commit59372da

File tree

23 files changed

+304
-151
lines changed

23 files changed

+304
-151
lines changed

‎fcs/docsrc/content/ja/tokenizer.fsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ let rec tokenizeLine (tokenizer:FSharpLineTokenizer) state =
7373
必要となるような新しい状態を返します。
7474
初期値としては `0L` を指定します:
7575
*)
76-
tokenizeLine tokenizer0L
76+
tokenizeLine tokenizerFSharpTokenizerLexState.Initial
7777
(**
7878
この結果は LET WHITESPACE IDENT EQUALS INT32 という
7979
トークン名のシーケンスになります。

‎fcs/docsrc/content/tokenizer.fsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let rec tokenizeLine (tokenizer:FSharpLineTokenizer) state =
6565
The function returns the new state, which is needed if you need to tokenize multiple lines
6666
and an earlier line ends with a multi-line comment. As an initial state, we can use `0L`:
6767
*)
68-
tokenizeLine tokenizer0L
68+
tokenizeLine tokenizerFSharpTokenizerLexState.Initial
6969
(**
7070
The result is a sequence of tokens with names LET, WHITESPACE, IDENT, EQUALS and INT32.
7171
There is a number of interesting properties on `FSharpTokenInfo` including:

‎fcs/samples/Tokenizer/Program.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
letsourceTok= FSharpSourceTokenizer([], Some"C:\\test.fsx")
44

55
lettokenizeLines(lines:string[])=
6-
[letstate= ref0L
6+
[letstate= refFSharpTokenizerLexState.Initial
77
for n, linein lines|> Seq.zip[0.. lines.Length]do
88
lettokenizer= sourceTok.CreateLineTokenizer(line)
99
let recparseLine()=seq{

‎src/fsharp/TypeChecker.fs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14700,11 +14700,11 @@ module EstablishTypeDefinitionCores =
1470014700
let AdjustModuleName modKind nm = (match modKind with FSharpModuleWithSuffix -> nm+FSharpModuleSuffix | _ -> nm)
1470114701

1470214702

14703-
let TypeNamesInMutRecDecls (compDecls: MutRecShapes<MutRecDefnsPhase1DataForTycon * 'MemberInfo, 'LetInfo, SynComponentInfo, _, _>) =
14703+
let TypeNamesInMutRecDeclscenv env(compDecls: MutRecShapes<MutRecDefnsPhase1DataForTycon * 'MemberInfo, 'LetInfo, SynComponentInfo, _, _>) =
1470414704
[ for d in compDecls do
1470514705
match d with
14706-
| MutRecShape.Tycon (MutRecDefnsPhase1DataForTycon(ComponentInfo(_,_, _, ids, _, _, _, _), _, _, _, _, isAtOriginalTyconDefn), _) ->
14707-
if isAtOriginalTyconDefn then
14706+
| MutRecShape.Tycon (MutRecDefnsPhase1DataForTycon(ComponentInfo(_,typars, _, ids, _, _, _, _), _, _, _, _, isAtOriginalTyconDefn), _) ->
14707+
if isAtOriginalTyconDefn&& (TcTyparDecls cenv env typars |> List.forall (fun p -> p.Kind = TyparKind.Measure))then
1470814708
yield (List.last ids).idText
1470914709
| _ -> () ]
1471014710
|> set
@@ -14751,7 +14751,7 @@ module EstablishTypeDefinitionCores =
1475114751
let envForDecls, mtypeAcc = MakeInnerEnv envInitial id modKind
1475214752
let mspec = NewModuleOrNamespace (Some envInitial.eCompPath) vis id (xml.ToXmlDoc()) modAttrs (MaybeLazy.Strict (NewEmptyModuleOrNamespaceType modKind))
1475314753
let innerParent = Parent (mkLocalModRef mspec)
14754-
let innerTypeNames = TypeNamesInMutRecDecls decls
14754+
let innerTypeNames = TypeNamesInMutRecDeclscenv envForDeclsdecls
1475514755
MutRecDefnsPhase2DataForModule (mtypeAcc, mspec), (innerParent, innerTypeNames, envForDecls)
1475614756

1475714757
/// Establish 'type <vis1> C < T1... TN > = <vis2> ...' including

‎src/fsharp/range.fs‎

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,98 +6,99 @@ module Microsoft.FSharp.Compiler.Range
66
openSystem
77
openSystem.IO
88
openSystem.Collections.Generic
9+
openSystem.Collections.Concurrent
910
openMicrosoft.FSharp.Core.Printf
10-
openInternal.Utilities
11-
openMicrosoft.FSharp.Compiler.AbstractIL
12-
openMicrosoft.FSharp.Compiler.AbstractIL.Internal
1311
openMicrosoft.FSharp.Compiler.AbstractIL.Internal.Library
14-
openMicrosoft.FSharp.Compiler
1512
openMicrosoft.FSharp.Compiler.Lib
1613
openMicrosoft.FSharp.Compiler.Lib.Bits
1714

1815
typeFileIndex= int32
1916

2017
[<Literal>]
21-
letcolumnBitCount=9
18+
letcolumnBitCount=20
2219
[<Literal>]
23-
letlineBitCount=16
20+
letlineBitCount=31
2421

2522
letposBitCount= lineBitCount+ columnBitCount
26-
let_=assert(posBitCount<=32)
27-
letposColumnMask= mask320 columnBitCount
28-
letlineColumnMask= mask32 columnBitCount lineBitCount
29-
let inline(lsr)(x:int)(y:int)= int32(uint32 x>>> y)
23+
let_=assert(posBitCount<=64)
24+
letposColumnMask= mask640 columnBitCount
25+
letlineColumnMask= mask64 columnBitCount lineBitCount
3026

3127
[<Struct; CustomEquality; NoComparison>]
3228
[<System.Diagnostics.DebuggerDisplay("{Line},{Column}")>]
33-
typepos(code:int32)=
29+
typepos(code:int64)=
3430
new(l,c)=
3531
letl= max0 l
3632
letc= max0 c
37-
letp=( c&&& posColumnMask)
38-
|||((l<<< columnBitCount)&&& lineColumnMask)
33+
letp=(int64 c&&& posColumnMask)
34+
|||((int64l<<< columnBitCount)&&& lineColumnMask)
3935
pos p
4036

41-
memberp.Line=(codelsr columnBitCount)
42-
memberp.Column=(code&&& posColumnMask)
37+
memberp.Line=int32(uint64code>>> columnBitCount)
38+
memberp.Column=int32(code&&& posColumnMask)
4339

4440
memberr.Encoding= code
4541
static memberEncodingSize= posBitCount
46-
static memberDecode(code:int32):pos= pos code
42+
static memberDecode(code:int64):pos= pos code
4743
overridep.Equals(obj)=match objwith:? posas p2-> code= p2.Encoding|_->false
4844
overridep.GetHashCode()= hash code
4945
overridep.ToString()= sprintf"(%d,%d)" p.Line p.Column
5046

5147
[<Literal>]
52-
letfileIndexBitCount=14
48+
letfileIndexBitCount=24
5349
[<Literal>]
54-
letstartLineBitCount=lineBitCount
50+
letstartColumnBitCount=columnBitCount// 20
5551
[<Literal>]
56-
letstartColumnBitCount= columnBitCount
52+
letendColumnBitCount= columnBitCount// 20
53+
5754
[<Literal>]
58-
letheightBitCount=15//If necessary, could probably deduct one or two bits here without ill effect.
55+
letstartLineBitCount=lineBitCount//31
5956
[<Literal>]
60-
letendColumnBitCount=columnBitCount
57+
letheightBitCount=27
6158
[<Literal>]
6259
letisSyntheticBitCount=1
6360
#if DEBUG
64-
let_=assert(fileIndexBitCount+ startLineBitCount+ startColumnBitCount+ heightBitCount+ endColumnBitCount+ isSyntheticBitCount=64)
61+
let_=assert(fileIndexBitCount+ startColumnBitCount+ endColumnBitCount<=64)
62+
let_=assert(startLineBitCount+ heightBitCount+ isSyntheticBitCount<=64)
6563
#endif
6664

6765
[<Literal>]
6866
letfileIndexShift=0
6967
[<Literal>]
70-
letstartLineShift=14
68+
letstartColumnShift=24
7169
[<Literal>]
72-
letstartColumnShift=30
70+
letendColumnShift=44
71+
7372
[<Literal>]
74-
letheightShift=39
73+
letstartLineShift=0
7574
[<Literal>]
76-
letendColumnShift=54
75+
letheightShift=31
7776
[<Literal>]
78-
letisSyntheticShift=63
77+
letisSyntheticShift=58
7978

8079

8180
[<Literal>]
82-
letfileIndexMask=0b0000000000000000000000000000000000000000000000000011111111111111L
81+
letfileIndexMask=0b0000000000000000000000000000000000000000111111111111111111111111L
8382
[<Literal>]
84-
letstartLineMask=0b0000000000000000000000000000000000111111111111111100000000000000L
83+
letstartColumnMask=0b0000000000000000000011111111111111111111000000000000000000000000L
8584
[<Literal>]
86-
letstartColumnMask=0b0000000000000000000000000111111111000000000000000000000000000000L
85+
letendColumnMask=0b1111111111111111111100000000000000000000000000000000000000000000L
86+
8787
[<Literal>]
88-
letheightMask=0b0000000000111111111111111000000000000000000000000000000000000000L
88+
letstartLineMask=0b0000000000000000000000000000000001111111111111111111111111111111L
8989
[<Literal>]
90-
letendColumnMask=0b0111111111000000000000000000000000000000000000000000000000000000L
90+
letheightMask=0b0000001111111111111111111111111110000000000000000000000000000000L
9191
[<Literal>]
92-
letisSyntheticMask=0b1000000000000000000000000000000000000000000000000000000000000000L
92+
letisSyntheticMask=0b0000010000000000000000000000000000000000000000000000000000000000L
9393

9494
#if DEBUG
95-
let_=assert(startLineShift= fileIndexShift+ fileIndexBitCount)
96-
let_=assert(startColumnShift= startLineShift+ startLineBitCount)
97-
let_=assert(heightShift= startColumnShift+ startColumnBitCount)
98-
let_=assert(endColumnShift= heightShift+ heightBitCount)
99-
let_=assert(isSyntheticShift= endColumnShift+ endColumnBitCount)
100-
let_=assert(fileIndexMask= mask640 fileIndexBitCount)
95+
let_=assert(startColumnShift= fileIndexShift+ fileIndexBitCount)
96+
let_=assert(endColumnShift= startColumnShift+ startColumnBitCount)
97+
98+
let_=assert(heightShift= startLineShift+ startLineBitCount)
99+
let_=assert(isSyntheticShift= heightShift+ heightBitCount)
100+
101+
let_=assert(fileIndexMask= mask64 fileIndexShift fileIndexBitCount)
101102
let_=assert(startLineMask= mask64 startLineShift startLineBitCount)
102103
let_=assert(startColumnMask= mask64 startColumnShift startColumnBitCount)
103104
let_=assert(heightMask= mask64 heightShift heightBitCount)
@@ -108,21 +109,17 @@ let _ = assert (isSyntheticMask = mask64 isSyntheticShift isSyntheticBitCount)
108109
// This is just a standard unique-index table
109110
typeFileIndexTable()=
110111
letindexToFileTable=new ResizeArray<_>(11)
111-
letfileToIndexTable=newDictionary<string, int>(11)
112+
letfileToIndexTable=newConcurrentDictionary<string, int>()
112113
membert.FileToIndex f=
113114
let mutableres=0
114115
letok= fileToIndexTable.TryGetValue(f,&res)
115116
if okthen res
116117
else
117118
lock fileToIndexTable(fun()->
118-
let mutableres=0in
119-
letok= fileToIndexTable.TryGetValue(f,&res)in
120-
if okthen res
121-
else
122-
letn= indexToFileTable.Countin
123-
indexToFileTable.Add(f)
124-
fileToIndexTable.[f]<- n
125-
n)
119+
letn= indexToFileTable.Countin
120+
indexToFileTable.Add(f)
121+
fileToIndexTable.[f]<- n
122+
n)
126123

127124
membert.IndexToFile n=
128125
(if n<0then failwithf"fileOfFileIndex: negative argument: n =%d\n" n)
@@ -147,28 +144,35 @@ let mkPos l c = pos (l, c)
147144
#else
148145
[<System.Diagnostics.DebuggerDisplay("({StartLine},{StartColumn}-{EndLine},{EndColumn}) {FileName} IsSynthetic={IsSynthetic}")>]
149146
#endif
150-
typerange(code:int64)=
151-
static memberZero= range(0L)
147+
typerange(code1:int64,code2:int64)=
148+
static memberZero= range(0L,0L)
152149
new(fidx,bl,bc,el,ec)=
153-
range( int64 fidx
154-
|||(int64 bl<<< startLineShift)
155-
|||(int64 bc<<< startColumnShift)
156-
|||(int64(el-bl)<<< heightShift)
157-
|||(int64 ec<<< endColumnShift))
150+
letcode1=((int64 fidx)&&& fileIndexMask)
151+
|||((int64 bc<<< startColumnShift)&&& startColumnMask)
152+
|||((int64 ec<<< endColumnShift)&&& endColumnMask)
153+
letcode2=
154+
((int64 bl<<< startLineShift)&&& startLineMask)
155+
|||((int64(el-bl)<<< heightShift)&&& heightMask)
156+
range(code1, code2)
158157

159158
new(fidx,b:pos,e:pos)= range(fidx, b.Line, b.Column, e.Line, e.Column)
160159

161-
memberr.StartLine= int32((code&&& startLineMask)>>> startLineShift)
162-
memberr.StartColumn= int32((code&&& startColumnMask)>>> startColumnShift)
163-
memberr.EndLine= int32((code&&& heightMask)>>> heightShift)+ r.StartLine
164-
memberr.EndColumn= int32((code&&& endColumnMask)>>> endColumnShift)
165-
memberr.IsSynthetic= int32((code&&& isSyntheticMask)>>> isSyntheticShift)<>0
160+
memberr.StartLine= int32((code2&&& startLineMask)>>> startLineShift)
161+
memberr.StartColumn= int32((code1&&& startColumnMask)>>> startColumnShift)
162+
memberr.EndLine= int32((code2&&& heightMask)>>> heightShift)+ r.StartLine
163+
memberr.EndColumn= int32((code1&&& endColumnMask)>>> endColumnShift)
164+
memberr.IsSynthetic= int32((code2&&& isSyntheticMask)>>> isSyntheticShift)<>0
166165
memberr.Start= pos(r.StartLine, r.StartColumn)
167166
memberr.End= pos(r.EndLine, r.EndColumn)
168-
memberr.FileIndex= int32(code&&& fileIndexMask)
167+
memberr.FileIndex= int32(code1&&& fileIndexMask)
169168
memberm.StartRange= range(m.FileIndex, m.Start, m.Start)
170169
memberm.EndRange= range(m.FileIndex, m.End, m.End)
171170
memberr.FileName= fileOfFileIndex r.FileIndex
171+
memberr.MakeSynthetic()= range(code1, code2||| isSyntheticMask)
172+
173+
memberr.Code1= code1
174+
memberr.Code2= code2
175+
172176
#if DEBUG
173177
memberr.DebugCode=
174178
try
@@ -182,12 +186,14 @@ type range(code:int64) =
182186
with e->
183187
e.ToString()
184188
#endif
185-
memberr.MakeSynthetic()= range(code||| isSyntheticMask)
186-
overrider.ToString()= sprintf"%s (%d,%d--%d,%d) IsSynthetic=%b" r.FileName r.StartLine r.StartColumn r.EndLine r.EndColumn r.IsSynthetic
189+
187190
memberr.ToShortString()= sprintf"(%d,%d--%d,%d)" r.StartLine r.StartColumn r.EndLine r.EndColumn
188-
memberr.Code= code
189-
overrider.Equals(obj)=match objwith:? rangeas r2-> code= r2.Code|_->false
190-
overrider.GetHashCode()= hash code
191+
192+
overrider.Equals(obj)=match objwith:? rangeas r2-> code1= r2.Code1&& code2= r2.Code2|_->false
193+
194+
overrider.GetHashCode()= hash code1+ hash code2
195+
196+
overrider.ToString()= sprintf"%s (%d,%d--%d,%d) IsSynthetic=%b" r.FileName r.StartLine r.StartColumn r.EndLine r.EndColumn r.IsSynthetic
191197

192198
letmkRange f b e=
193199
// remove relative parts from full path

‎src/fsharp/range.fsi‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ type pos =
2020
memberLine:int
2121
memberColumn:int
2222

23-
memberEncoding:int32
24-
static memberDecode:int32->pos
23+
memberEncoding:int64
24+
static memberDecode:int64->pos
2525
/// The maximum number of bits needed to store an encoded position
26-
static memberEncodingSize:int32
26+
static memberEncodingSize:int
2727

2828
/// Create a position for the given line and column
2929
valmkPos:line:int->column:int->pos

‎src/fsharp/service/IncrementalBuild.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,8 +1282,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput
12821282

12831283
result, sourceRange, filename, errorLogger.GetErrors()
12841284
with exn->
1285-
System.Diagnostics.Debug.Assert(false, sprintf"unexpected failure in IncrementalFSharpBuild.Parse\nerror =%s"(exn.ToString()))
1286-
failwith"last chance failure"
1285+
letmsg= sprintf"unexpected failure in IncrementalFSharpBuild.Parse\nerror =%s"(exn.ToString())
1286+
System.Diagnostics.Debug.Assert(false, msg)
1287+
failwith msg
12871288

12881289

12891290
/// This is a build task function that gets placed into the build rules as the computation for a Vector.Stamp

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp