Skip to content

Commit afe0aa7

Browse files
authored
Fix null safety errors (#150)
* Fix null safety errors * idk where is vanilla installation instructions * update haxe-version
1 parent 953e3bc commit afe0aa7

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

.github/workflows/main-vanilla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
# TODO: fix tests on windows and enable again
1111
# os: [ubuntu-latest, macos-13, windows-latest]
1212
os: [ubuntu-latest, macos-13]
13-
haxe: [latest, "2025-08-04_development_8d19bc5"]
13+
haxe: [latest, "2026-03-04_development_033a9fd"]
1414
runs-on: ${{ matrix.os }}
1515
steps:
1616
- uses: actions/checkout@v2

.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()

install.hxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
-lib hxparse:git:https://github.com/simn/hxparse#876070ec62a4869de60081f87763e23457a3bda8
55
-lib json2object:git:https://github.com/elnabo/json2object#a75859de1e966c09e73591b6c9186086c143fe60
66
-lib test-adapter:3.0.0
7-
-lib utest:git:https://github.com/haxe-utest/utest#bdb5fec4b8e77d9a3c079d9cfb108f29f153721a
7+
-lib utest:git:https://github.com/haxe-utest/utest#a055e05e2e872ae12a32b53d0200612345059c38
88
-lib hxnodejs:git:https://github.com/HaxeFoundation/hxnodejs#504066d
99
-lib tokentree:1.2.18
1010
-lib language-server-protocol:git:https://github.com/vshaxe/language-server-protocol-haxe#20a7f976bc83ec6623cc25144c88f4c15a799586
1111
-lib hxjsonast:1.1.0
1212
-lib vscode-json-rpc:git:https://github.com/vshaxe/vscode-json-rpc#0160f06bc9df1dd0547f2edf23753540db74ed5b
1313
-lib rename:3.0.1
1414
-lib vshaxe-build:git:https://github.com/vshaxe/vshaxe-build#39ab9c6315ae76080e5399391c8fa561daec6d55
15-
-lib safety:1.1.2
15+
-lib safety:git:https://github.com/RealyUniqueName/Safety#b3f1c34ef185d127196b04541950c32b7683863f

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)