Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed May 23, 2024
1 parent f76fb68 commit 9775798
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 34 deletions.
3 changes: 3 additions & 0 deletions src/Compiler/Driver/CompilerDiagnostics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ type PhasedDiagnostic with
| 3579 -> false // alwaysUseTypedStringInterpolation - off by default
| 3582 -> false // infoIfFunctionShadowsUnionCase - off by default
| 3570 -> false // tcAmbiguousDiscardDotLambda - off by default
| 1104 -> false // lexhlpIdentifiersContainingAtSymbolReserved
| 1105 -> false // lexhlpIdentifierReserved
| 9999 -> false // mlCompatKeyword
| _ ->
match x.Exception with
| DiagnosticEnabledWithLanguageFeature(_, _, _, enabled) -> enabled
Expand Down
13 changes: 9 additions & 4 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3584,7 +3584,7 @@ type FsiStdinLexerProvider
tokenizer

// Create a new lexer to read stdin
member _.CreateStdinLexer diagnosticsLogger =
member _.CreateStdinLexer (diagnosticsLogger: DiagnosticsLogger) =
let lexbuf =
match fsiConsoleInput.TryGetConsole() with
| Some console when fsiOptions.EnableConsoleKeyProcessing && not fsiOptions.UseServerPrompt ->
Expand All @@ -3595,20 +3595,24 @@ type FsiStdinLexerProvider
| _ -> LexbufFromLineReader fsiStdinSyphon (fun () -> fsiConsoleInput.In.ReadLine() |> removeZeroCharsFromString)

fsiStdinSyphon.Reset()
fprintfn fsiConsoleOutput.Out "...In CreateStdinLexer"
CreateLexerForLexBuffer(stdinMockFileName, lexbuf, diagnosticsLogger)

// Create a new lexer to read an "included" script file
member _.CreateIncludedScriptLexer(sourceFileName, reader, diagnosticsLogger) =
member _.CreateIncludedScriptLexer(sourceFileName, reader, (diagnosticsLogger: DiagnosticsLogger)) =
let lexbuf =
UnicodeLexing.StreamReaderAsLexbuf(true, tcConfigB.langVersion, tcConfigB.strictIndentation, reader)

fprintfn fsiConsoleOutput.Out "...In CreateIncludedScriptLexer"
diagnosticsLogger.DiagnosticSink({ Exception = exn "foo bar"; Phase = BuildPhase.DefaultPhase}, FSharpDiagnosticSeverity.Warning)
CreateLexerForLexBuffer(sourceFileName, lexbuf, diagnosticsLogger)

// Create a new lexer to read a string
member _.CreateStringLexer(sourceFileName, source, diagnosticsLogger) =
member _.CreateStringLexer(sourceFileName, source, (diagnosticsLogger: DiagnosticsLogger)) =
let lexbuf =
UnicodeLexing.StringAsLexbuf(true, tcConfigB.langVersion, tcConfigB.strictIndentation, source)


fprintfn fsiConsoleOutput.Out "...In CreateStringLexer"
CreateLexerForLexBuffer(sourceFileName, lexbuf, diagnosticsLogger)

member _.ConsoleInput = fsiConsoleInput
Expand Down Expand Up @@ -3790,6 +3794,7 @@ type FsiInteractionProcessor
istate, Completed None

| ParsedHashDirective("nowarn", ParsedHashDirectiveArguments numbers, m) ->
fprintfn fsiConsoleOutput.Out "...Parsing #nowarn"
List.iter (fun (d: string) -> tcConfigB.TurnWarningOff(m, d)) numbers
istate, Completed None

Expand Down
6 changes: 4 additions & 2 deletions src/Compiler/Service/ServiceLexing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ module internal TokenClassifications =
| CHAR _ -> (FSharpTokenColorKind.String, FSharpTokenCharKind.String, FSharpTokenTriggerClass.None)

| EOF _ -> failwith "tokenInfo"
|> fun (_x, y, z) -> (FSharpTokenColorKind.String, y, z)

module internal TestExpose =
let TokenInfo tok = TokenClassifications.tokenInfo tok
Expand Down Expand Up @@ -1205,8 +1206,9 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, maxLength: int option, fi

tokenDataOption, lexintFinal

static member ColorStateOfLexState(lexState: FSharpTokenizerLexState) =
LexerStateEncoding.colorStateOfLexState lexState
static member ColorStateOfLexState(_lexState: FSharpTokenizerLexState) =
//LexerStateEncoding.colorStateOfLexState lexState
FSharpTokenizerColorState.String

static member LexStateOfColorState(colorState: FSharpTokenizerColorState) =
{
Expand Down
3 changes: 3 additions & 0 deletions src/FSharp.Core/prim-types-prelude.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Microsoft.FSharp.Core

#nowarn "42"
#nowarn "44"

//-------------------------------------------------------------------------
// Basic type abbreviations

Expand Down
26 changes: 13 additions & 13 deletions tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,13 +1150,13 @@ module RangeTests =
| :? Value as b' -> compare a.Value b'.Value
| _ -> failwith "unsupported"

[<Fact>]
let ``Range.UserDefined``() =
// using a user defined type, as opposed to a primitive, as the base type
let rangeList = [Value 0 .. Step 2 .. Value 2]
let rangeArray = [Value 0 .. Step 2 .. Value 2]
Assert.AreEqual(2, rangeList.Length)
Assert.AreEqual(2, rangeArray.Length)
//[<Fact>]
//let ``Range.UserDefined``() =
// // using a user defined type, as opposed to a primitive, as the base type
// let rangeList = [Value 0 .. Step 2 .. Value 2]
// let rangeArray = [Value 0 .. Step 2 .. Value 2]
// Assert.AreEqual(2, rangeList.Length)
// Assert.AreEqual(2, rangeArray.Length)


/// These tests' arguments are intentionally _not_ inlined
Expand Down Expand Up @@ -1243,12 +1243,12 @@ module RangeTests =
let zero, one, min0, max0 = System.UIntPtr 0u, System.UIntPtr 1u, System.UIntPtr System.UInt64.MinValue, System.UIntPtr System.UInt64.MaxValue
RangeTestsHelpers.unsigned zero one min0 max0

[<Fact>]
let ``Range.UserDefined``() =
let rangeList = [Value 0 .. Step 2 .. Value 2]
let rangeArray = [Value 0 .. Step 2 .. Value 2]
Assert.AreEqual(2, rangeList.Length)
()
//[<Fact>]
//let ``Range.UserDefined``() =
// let rangeList = [Value 0 .. Step 2 .. Value 2]
// let rangeArray = [Value 0 .. Step 2 .. Value 2]
// Assert.AreEqual(2, rangeList.Length)
// ()

open NonStructuralComparison

Expand Down
30 changes: 15 additions & 15 deletions vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -493,19 +493,19 @@ module internal Tokenizer =

let compilerTokenToRoslynToken (colorKind: FSharpTokenColorKind) : string =
match colorKind with
| FSharpTokenColorKind.Comment -> ClassificationTypeNames.Comment
| FSharpTokenColorKind.Identifier -> ClassificationTypeNames.Identifier
| FSharpTokenColorKind.Keyword -> ClassificationTypeNames.Keyword
| FSharpTokenColorKind.Comment -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Identifier -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Keyword -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.String -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Text -> ClassificationTypeNames.Text
| FSharpTokenColorKind.UpperIdentifier -> ClassificationTypeNames.Identifier
| FSharpTokenColorKind.Number -> ClassificationTypeNames.NumericLiteral
| FSharpTokenColorKind.InactiveCode -> ClassificationTypeNames.ExcludedCode
| FSharpTokenColorKind.PreprocessorKeyword -> ClassificationTypeNames.PreprocessorKeyword
| FSharpTokenColorKind.Operator -> ClassificationTypeNames.Operator
| FSharpTokenColorKind.Punctuation -> ClassificationTypeNames.Punctuation
| FSharpTokenColorKind.Text -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.UpperIdentifier -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Number -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.InactiveCode -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.PreprocessorKeyword -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Operator -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Punctuation -> ClassificationTypeNames.StringLiteral
| FSharpTokenColorKind.Default
| _ -> ClassificationTypeNames.Text
| _ -> ClassificationTypeNames.StringLiteral

let private scanSourceLine
(
Expand Down Expand Up @@ -545,8 +545,8 @@ module internal Tokenizer =
{
LeftColumn = info.LeftColumn
RightColumn = info.RightColumn - 2
ColorClass = FSharpTokenColorKind.Number
CharClass = FSharpTokenCharKind.Literal
ColorClass = FSharpTokenColorKind.String
CharClass = FSharpTokenCharKind.String
FSharpTokenTriggerClass = info.FSharpTokenTriggerClass
Tag = info.Tag
TokenName = "INT32"
Expand All @@ -560,8 +560,8 @@ module internal Tokenizer =
{
LeftColumn = info.RightColumn - 1
RightColumn = info.RightColumn
ColorClass = FSharpTokenColorKind.Operator
CharClass = FSharpTokenCharKind.Operator
ColorClass = FSharpTokenColorKind.String
CharClass = FSharpTokenCharKind.String
FSharpTokenTriggerClass = info.FSharpTokenTriggerClass
Tag = FSharpTokenTag.DOT_DOT
TokenName = "DOT_DOT"
Expand Down

0 comments on commit 9775798

Please sign in to comment.