Skip to content

Commit 70a9a76

Browse files
committed
Fix null safety errors
1 parent 953e3bc commit 70a9a76

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

.haxerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "8d19bc5",
2+
"version": "033a9fd",
33
"resolveLibs": "scoped"
44
}

haxe_libraries/safety.hxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# @install: lix --silent download "haxelib:/safety#1.1.2" into safety/1.1.2/haxelib
2-
-cp ${HAXE_LIBCACHE}/safety/1.1.2/haxelib/src
1+
# @install: lix --silent download "gh://github.com/RealyUniqueName/Safety#b3f1c34ef185d127196b04541950c32b7683863f" into safety/1.1.2/github/b3f1c34ef185d127196b04541950c32b7683863f
2+
-cp ${HAXE_LIBCACHE}/safety/1.1.2/github/b3f1c34ef185d127196b04541950c32b7683863f/src
33
-D safety=1.1.2

haxe_libraries/utest.hxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @install: lix --silent download "gh://github.com/haxe-utest/utest#bdb5fec4b8e77d9a3c079d9cfb108f29f153721a" into utest/2.0.0-alpha/github/bdb5fec4b8e77d9a3c079d9cfb108f29f153721a
2-
-cp ${HAXE_LIBCACHE}/utest/2.0.0-alpha/github/bdb5fec4b8e77d9a3c079d9cfb108f29f153721a/src
1+
# @install: lix --silent download "gh://github.com/haxe-utest/utest#a055e05e2e872ae12a32b53d0200612345059c38" into utest/2.0.0-alpha/github/a055e05e2e872ae12a32b53d0200612345059c38
2+
-cp ${HAXE_LIBCACHE}/utest/2.0.0-alpha/github/a055e05e2e872ae12a32b53d0200612345059c38/src
33
-D utest=2.0.0-alpha
44
--macro utest.utils.Macro.importEnvSettings()

src/haxeLanguageServer/Context.hx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Context {
8383
haxeDisplayProtocol = new Protocol(@:nullSafety(Off) writeMessage);
8484
haxeServer = @:nullSafety(Off) new HaxeServer(this);
8585
documents = new TextDocuments();
86-
config = new Configuration(languageServerProtocol, kind -> restartServer('$kind configuration was changed'));
86+
config = new Configuration(languageServerProtocol, kind -> @:nullSafety(Off) restartServer('$kind configuration was changed'));
8787

8888
languageServerProtocol.onRequest(InitializeRequest.type, onInitialize);
8989
languageServerProtocol.onRequest(ShutdownRequest.type, onShutdown);
@@ -105,7 +105,7 @@ class Context {
105105
return; // don't send cancel notifications, not supported by Haxe
106106
}
107107
final includeDisplayArguments = method.startsWith("display/") || method == ServerMethods.ReadClassPaths;
108-
callDisplay(method, [Json.stringify(message)], token, function(result:DisplayResult) {
108+
callDisplay(method, [Json.stringify(message)], null, token, function(result:DisplayResult) {
109109
switch result {
110110
case DResult("") if (method == DisplayMethods.Diagnostics):
111111
haxeDisplayProtocol.handleMessage(({
@@ -122,15 +122,14 @@ class Context {
122122
Json.parse(error);
123123
} catch (_:Any) {
124124
// pretend we got a proper JSON (HaxeFoundation/haxe#7955)
125+
final errData:HaxeResponseErrorData = {
126+
severity: Error,
127+
message: error
128+
}
125129
final message:ResponseMessage = {
126130
jsonrpc: Protocol.PROTOCOL_VERSION,
127131
id: @:privateAccess haxeDisplayProtocol.nextRequestId - 1, // ew..
128-
error: new ResponseError(ResponseError.InternalError, "Compiler error", ([
129-
{
130-
severity: Error,
131-
message: error
132-
}
133-
] : HaxeResponseErrorData))
132+
error: new ResponseError(ResponseError.InternalError, "Compiler error", [errData])
134133
}
135134
message;
136135
});

src/haxeLanguageServer/features/haxe/completion/CompletionFeature.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class CompletionFeature {
6767
explicitNull: true
6868
});
6969

70-
legacy = new CompletionFeatureLegacy(context, contextSupport, formatDocumentation);
70+
legacy = new CompletionFeatureLegacy(context, contextSupport, @:nullSafety(Off) formatDocumentation);
7171
}
7272

7373
function checkCapabilities() {

test/testcases/EditTestCaseMacro.hx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ class EditTestCaseMacro {
4646
}
4747

4848
static function collectAllFileNames(path:String):Array<String> {
49-
#if display
50-
return [];
51-
#end
49+
if (Context.defined("display"))
50+
return [];
5251
final items:Array<String> = FileSystem.readDirectory(path);
5352
var files:Array<String> = [];
5453
for (item in items) {

0 commit comments

Comments
 (0)