Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/ast/parseoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/microsoft/typescript-go/internal/tspath"
)

type JSDocParsingMode int
type JSDocParsingMode uint8

const (
JSDocParsingModeParseAll JSDocParsingMode = iota
Expand Down
2 changes: 1 addition & 1 deletion internal/ast/subtreefacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/microsoft/typescript-go/internal/core"
)

type SubtreeFacts int32
type SubtreeFacts uint32

const (
// Facts
Expand Down
2 changes: 1 addition & 1 deletion internal/checker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const TypeFormatFlagsNodeBuilderFlagsMask = TypeFormatFlagsNoTruncation | TypeFo
TypeFormatFlagsUseTypeOfFunction | TypeFormatFlagsOmitParameterModifiers | TypeFormatFlagsUseAliasDefinedOutsideCurrentScope | TypeFormatFlagsAllowUniqueESSymbolType | TypeFormatFlagsInTypeAlias |
TypeFormatFlagsUseSingleQuotesForStringLiteralType | TypeFormatFlagsNoTypeReduction | TypeFormatFlagsOmitThisParameter

type SymbolFormatFlags int32
type SymbolFormatFlags uint32

const (
SymbolFormatFlagsNone SymbolFormatFlags = 0
Expand Down
6 changes: 3 additions & 3 deletions internal/module/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ type rawArgs struct {
Name string `json:"name"`
ContainingFile string `json:"containingFile"`
CompilerOptions *core.CompilerOptions `json:"compilerOptions"`
ResolutionMode int `json:"resolutionMode"`
ResolutionMode core.ModuleKind `json:"resolutionMode"`
RedirectedRef *struct {
SourceFile struct {
FileName string `json:"fileName"`
Expand Down Expand Up @@ -265,7 +265,7 @@ func doCall(t *testing.T, resolver *module.Resolver, call functionCall, skipLoca

errorMessageArgs := []any{call.args.Name, call.args.ContainingFile}
if call.call == "resolveModuleName" {
resolved, _ := resolver.ResolveModuleName(call.args.Name, call.args.ContainingFile, core.ModuleKind(call.args.ResolutionMode), redirectedReference)
resolved, _ := resolver.ResolveModuleName(call.args.Name, call.args.ContainingFile, call.args.ResolutionMode, redirectedReference)
assert.Check(t, resolved != nil, "ResolveModuleName should not return nil", errorMessageArgs)
if expectedResolvedModule, ok := call.returnValue["resolvedModule"].(map[string]any); ok {
assert.Check(t, resolved.IsResolved(), errorMessageArgs)
Expand All @@ -277,7 +277,7 @@ func doCall(t *testing.T, resolver *module.Resolver, call functionCall, skipLoca
assert.Check(t, !resolved.IsResolved(), errorMessageArgs)
}
} else {
resolved, _ := resolver.ResolveTypeReferenceDirective(call.args.Name, call.args.ContainingFile, core.ModuleKind(call.args.ResolutionMode), redirectedReference)
resolved, _ := resolver.ResolveTypeReferenceDirective(call.args.Name, call.args.ContainingFile, call.args.ResolutionMode, redirectedReference)
assert.Check(t, resolved != nil, "ResolveTypeReferenceDirective should not return nil", errorMessageArgs)
if expectedResolvedTypeReferenceDirective, ok := call.returnValue["resolvedTypeReferenceDirective"].(map[string]any); ok {
assert.Check(t, resolved.IsResolved(), errorMessageArgs)
Expand Down
2 changes: 1 addition & 1 deletion internal/nodebuilder/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type SymbolTracker interface {
}

// NOTE: If modifying this enum, must modify `TypeFormatFlags` too!
type Flags int32
type Flags uint32

const (
FlagsNone Flags = 0
Expand Down
4 changes: 2 additions & 2 deletions internal/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ func FuzzParser(f *testing.F) {
sourceText, err := os.ReadFile(file.path)
assert.NilError(f, err)
extension := tspath.TryGetExtensionFromPath(file.path)
f.Add(extension, string(sourceText), int(core.ScriptTargetESNext), int(ast.JSDocParsingModeParseAll))
f.Add(extension, string(sourceText), int32(core.ScriptTargetESNext), uint8(ast.JSDocParsingModeParseAll))
}
}

f.Fuzz(func(t *testing.T, extension string, sourceText string, scriptTarget_ int, jsdocParsingMode_ int) {
f.Fuzz(func(t *testing.T, extension string, sourceText string, scriptTarget_ int32, jsdocParsingMode_ uint8) {
scriptTarget := core.ScriptTarget(scriptTarget_)
jsdocParsingMode := ast.JSDocParsingMode(jsdocParsingMode_)

Expand Down
4 changes: 2 additions & 2 deletions internal/parser/testdata/fuzz/FuzzParser/02b74efe61495c2a
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
go test fuzz v1
string(".ts")
string("/**@0\n * */0")
int(99)
int(0)
int32(99)
uint8(0)
4 changes: 2 additions & 2 deletions internal/parser/testdata/fuzz/FuzzParser/9ce2d994c65c7bfe
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
go test fuzz v1
string(".ts")
string("/")
int(99)
int(1)
int32(99)
uint8(1)
5 changes: 2 additions & 3 deletions internal/vfs/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,10 @@ var (
)

func GetRegexFromPattern(pattern string, useCaseSensitiveFileNames bool) *regexp2.Regexp {
flags := regexp2.ECMAScript
opts := regexp2.RegexOptions(regexp2.ECMAScript)
if !useCaseSensitiveFileNames {
flags |= regexp2.IgnoreCase
opts |= regexp2.IgnoreCase
}
opts := regexp2.RegexOptions(flags)

key := regexp2CacheKey{pattern, opts}

Expand Down
Loading