From 94882d2e64bbaf615e7809ca30f355e939ada05b Mon Sep 17 00:00:00 2001 From: Sora Date: Sun, 30 Apr 2023 19:21:43 +0200 Subject: [PATCH] Update config to highlight danger of the comptime interpreter (#1162) --- README.md | 2 +- schema.json | 2 +- src/Config.zig | 2 +- src/analysis.zig | 4 ++-- src/config_gen/config.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3b9f774..46bcb1f 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ The following options are currently available. | `operator_completions` | `bool` | `true` | Enables `*` and `?` operators in completion lists | | `warn_style` | `bool` | `false` | Enables warnings for style guideline mismatches | | `highlight_global_var_declarations` | `bool` | `false` | Whether to highlight global var declarations | -| `use_comptime_interpreter` | `bool` | `false` | Whether to use the comptime interpreter | +| `dangerous_comptime_experiments_do_not_enable` | `bool` | `false` | Whether to use the comptime interpreter | | `include_at_in_builtins` | `bool` | `false` | Whether the @ sign should be part of the completion of builtins | | `skip_std_references` | `bool` | `false` | When true, skips searching for references in std. Improves lookup speed for functions in user's code. Renaming and go-to-definition will continue to work as is | | `max_detail_length` | `usize` | `1048576` | The detail field of completions is truncated to be no longer than this (in bytes) | diff --git a/schema.json b/schema.json index 59931d2..554c6f0 100644 --- a/schema.json +++ b/schema.json @@ -74,7 +74,7 @@ "type": "boolean", "default": "false" }, - "use_comptime_interpreter": { + "dangerous_comptime_experiments_do_not_enable": { "description": "Whether to use the comptime interpreter", "type": "boolean", "default": "false" diff --git a/src/Config.zig b/src/Config.zig index d9fd7cf..0a8d3f7 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -50,7 +50,7 @@ warn_style: bool = false, highlight_global_var_declarations: bool = false, /// Whether to use the comptime interpreter -use_comptime_interpreter: bool = false, +dangerous_comptime_experiments_do_not_enable: bool = false, /// Whether the @ sign should be part of the completion of builtins include_at_in_builtins: bool = false, diff --git a/src/analysis.zig b/src/analysis.zig index d6557a5..819ec82 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -653,7 +653,7 @@ pub fn isTypeIdent(text: []const u8) bool { .{"type"}, .{"anyerror"}, .{"comptime_int"}, .{"comptime_float"}, .{"anyframe"}, .{"anytype"}, - .{"c_char"} + .{"c_char"}, }); if (PrimitiveTypes.has(text)) return true; @@ -810,7 +810,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e const body = decl.handle.tree.nodes.items(.data)[decl_node].rhs; if (try analyser.resolveReturnType(fn_decl, decl.handle, if (has_body) body else null)) |ret| { return ret; - } else if (analyser.store.config.use_comptime_interpreter) { + } else if (analyser.store.config.dangerous_comptime_experiments_do_not_enable) { // TODO: Better case-by-case; we just use the ComptimeInterpreter when all else fails, // probably better to use it more liberally // TODO: Handle non-isolate args; e.g. `const T = u8; TypeFunc(T);` diff --git a/src/config_gen/config.json b/src/config_gen/config.json index 2b4821d..8d796e0 100644 --- a/src/config_gen/config.json +++ b/src/config_gen/config.json @@ -84,7 +84,7 @@ "default": "false" }, { - "name": "use_comptime_interpreter", + "name": "dangerous_comptime_experiments_do_not_enable", "description": "Whether to use the comptime interpreter", "type": "bool", "default": "false"