Skip to content

Commit 462d7ee

Browse files
committed
Add flag for no strict DM types in analyze CLI
1 parent 015d1dd commit 462d7ee

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99
### Fixed
1010

1111
- Fixed forced expressive types in diagnostics
12+
- Added option `--no-strict-dm-types` for analyze CLI to disable strict datamodel types and its associated false positives
1213

1314
## [1.19.1] - 2023-04-27
1415

src/AnalyzeCli.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ int startAnalyze(int argc, char** argv)
147147
std::vector<std::filesystem::path> files{};
148148
std::vector<std::string> ignoreGlobPatterns{};
149149
std::optional<std::filesystem::path> baseLuaurc = std::nullopt;
150+
bool expressiveTypes = true;
150151

151152
for (int i = 2; i < argc; ++i)
152153
{
@@ -161,6 +162,8 @@ int startAnalyze(int argc, char** argv)
161162
annotate = true;
162163
else if (strcmp(argv[i], "--timetrace") == 0)
163164
FFlag::DebugLuauTimeTracing.value = true;
165+
else if (strcmp(argv[i], "--no-strict-dm-types") == 0)
166+
expressiveTypes = false;
164167
else if (strncmp(argv[i], "--sourcemap=", 12) == 0)
165168
sourcemapPath = std::string(argv[i] + 12);
166169
else if (strncmp(argv[i], "--definitions=", 14) == 0)
@@ -307,7 +310,7 @@ int startAnalyze(int argc, char** argv)
307310
}
308311
}
309312

310-
types::registerInstanceTypes(frontend, frontend.globals, frontend.globals.globalTypes, fileResolver, /* TODO - expressiveTypes: */ true);
313+
types::registerInstanceTypes(frontend, frontend.globals, frontend.globals.globalTypes, fileResolver, expressiveTypes);
311314

312315
Luau::freeze(frontend.globals.globalTypes);
313316
Luau::freeze(frontend.globalsForAutocomplete.globalTypes);

src/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ static bool validateFlag(char* str, int argIndex)
4646
return true;
4747
else if (strcmp(str, "--timetrace") == 0)
4848
return true;
49+
else if (strcmp(str, "--no-strict-dm-types") == 0)
50+
return true;
4951
else if (strncmp(str, "--sourcemap=", 12) == 0 && n > 13)
5052
return true;
5153
else if (strncmp(str, "--defs=", 7) == 0 && n > 8)
@@ -84,6 +86,7 @@ static void displayHelp(const char* argv0)
8486
printf(" --formatter=plain: report analysis errors in Luacheck-compatible format\n");
8587
printf(" --formatter=gnu: report analysis errors in GNU-compatible format\n");
8688
printf(" --timetrace: record compiler time tracing information into trace.json\n");
89+
printf(" --no-strict-dm-types: disable strict DataModel types in type-checking\n");
8790
printf(" --sourcemap=PATH: path to a Rojo-style sourcemap\n");
8891
printf(" --definitions=PATH: path to definition file for global types\n");
8992
printf(" --ignore=GLOB: glob pattern to ignore error outputs\n");

0 commit comments

Comments
 (0)