Enable stage2 (#810)

This commit is contained in:
Auguste Rame 2022-12-07 11:39:46 -05:00 committed by GitHub
parent 887539ed1a
commit 1e99692d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

View File

@ -13,7 +13,6 @@ pub fn build(b: *std.build.Builder) !void {
const mode = b.standardReleaseOptions(); const mode = b.standardReleaseOptions();
const exe = b.addExecutable("zls", "src/main.zig"); const exe = b.addExecutable("zls", "src/main.zig");
exe.use_stage1 = true;
const exe_options = b.addOptions(); const exe_options = b.addOptions();
exe.addOptions("build_options", exe_options); exe.addOptions("build_options", exe_options);
@ -134,7 +133,6 @@ pub fn build(b: *std.build.Builder) !void {
}); });
} }
tests.use_stage1 = true;
tests.addPackage(.{ .name = "zls", .source = .{ .path = "src/zls.zig" }, .dependencies = exe.packages.items }); tests.addPackage(.{ .name = "zls", .source = .{ .path = "src/zls.zig" }, .dependencies = exe.packages.items });
tests.setBuildMode(.Debug); tests.setBuildMode(.Debug);
tests.setTarget(target); tests.setTarget(target);

View File

@ -32,18 +32,18 @@ test "ComptimeInterpreter - basic test" {
_ = try interpreter.interpret(0, null, .{}); _ = try interpreter.interpret(0, null, .{});
var bool_type = try interpreter.createType(std.math.maxInt(std.zig.Ast.Node.Index), .{ .@"bool" = .{} }); var bool_type = try interpreter.createType(std.math.maxInt(std.zig.Ast.Node.Index), .{ .bool = {} });
var arg_false = ComptimeInterpreter.Value{ var arg_false = ComptimeInterpreter.Value{
.interpreter = &interpreter, .interpreter = &interpreter,
.node_idx = std.math.maxInt(std.zig.Ast.Node.Index), .node_idx = std.math.maxInt(std.zig.Ast.Node.Index),
.@"type" = bool_type, .type = bool_type,
.value_data = try interpreter.createValueData(.{ .@"bool" = false }), .value_data = try interpreter.createValueData(.{ .bool = false }),
}; };
var arg_true = ComptimeInterpreter.Value{ var arg_true = ComptimeInterpreter.Value{
.interpreter = &interpreter, .interpreter = &interpreter,
.node_idx = std.math.maxInt(std.zig.Ast.Node.Index), .node_idx = std.math.maxInt(std.zig.Ast.Node.Index),
.@"type" = bool_type, .type = bool_type,
.value_data = try interpreter.createValueData(.{ .@"bool" = true }), .value_data = try interpreter.createValueData(.{ .bool = true }),
}; };
const rmt = interpreter.root_type.?.getTypeInfo().@"struct".scope.declarations.get("ReturnMyType").?; const rmt = interpreter.root_type.?.getTypeInfo().@"struct".scope.declarations.get("ReturnMyType").?;
@ -57,8 +57,8 @@ test "ComptimeInterpreter - basic test" {
}, .{}); }, .{});
defer call_with_true.scope.deinit(); defer call_with_true.scope.deinit();
try std.testing.expectFmt("u69", "{any}", .{interpreter.formatTypeInfo(call_with_false.result.value.value_data.@"type".getTypeInfo())}); try std.testing.expectFmt("u69", "{any}", .{interpreter.formatTypeInfo(call_with_false.result.value.value_data.type.getTypeInfo())});
try std.testing.expectFmt("u8", "{any}", .{interpreter.formatTypeInfo(call_with_true.result.value.value_data.@"type".getTypeInfo())}); try std.testing.expectFmt("u8", "{any}", .{interpreter.formatTypeInfo(call_with_true.result.value.value_data.type.getTypeInfo())});
} }
test "ComptimeInterpreter - struct" { test "ComptimeInterpreter - struct" {
@ -92,5 +92,5 @@ test "ComptimeInterpreter - struct" {
const z = try interpreter.call(null, rmt.node_idx, &.{}, .{}); const z = try interpreter.call(null, rmt.node_idx, &.{}, .{});
defer z.scope.deinit(); defer z.scope.deinit();
try std.testing.expectFmt("struct {slay: bool, var abc: comptime_int = 123, }", "{any}", .{interpreter.formatTypeInfo(z.result.value.value_data.@"type".getTypeInfo())}); try std.testing.expectFmt("struct {slay: bool, var abc: comptime_int = 123, }", "{any}", .{interpreter.formatTypeInfo(z.result.value.value_data.type.getTypeInfo())});
} }

View File

@ -47,7 +47,7 @@ fn testSelectionRange(source: []const u8, want: []const []const u8) !void {
const request = requests.SelectionRange{ .params = .{ const request = requests.SelectionRange{ .params = .{
.textDocument = .{ .uri = test_uri }, .textDocument = .{ .uri = test_uri },
.positions = &.{position}, .positions = &[_]types.Position{position},
} }; } };
const response = try ctx.requestGetResponse(?[]SelectionRange, "textDocument/selectionRange", request); const response = try ctx.requestGetResponse(?[]SelectionRange, "textDocument/selectionRange", request);