chore(vendor): update tree-sitter-kotlin to 0.4.0-gd6af96d (#3801)

* chore(vendor): update tree-sitter-kotlin to 0.4.0-gd6af96d

* fix(kotlin): enable C11 Windows builds

MSVS ignores cflags_c, leaving _Static_assert in legacy C mode.
Assert parser behavior so stale prebuilds fail the vendor update.

Refs #3801

* fix(kotlin): scope MSVC standards by language

Use MSBuild language properties and remove Node headers raw C++20 flag.
Preserve inherited C++ exception handling while compiling scanner C as C11.

* chore(vendor): rebuild native prebuilds (tree-sitter-kotlin)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/41414632633

* chore(vendor): rebuild native prebuilds (tree-sitter-kotlin)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/41418217222

* chore(vendor): rebuild native prebuilds (tree-sitter-kotlin)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/41433953854

---------

Co-authored-by: gitnexus-release-bot[bot] <gitnexus-release-bot[bot]@users.noreply.github.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
This commit is contained in:
gitnexus-release-bot[bot] 2026-11-03 08:04:52 +00:00 • committed by GitHub
parent 4916e0d5e1
commit 24d3de239d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 918677 additions and 876163 deletions

View file

@ -178,7 +178,7 @@ describe('CLI commands', () => {
// ships source only) and loaded from vendor/ by absolute path (#2111).
expect(optional['tree-sitter-kotlin']).toBeUndefined();
expect(pkg.default.scripts.postinstall).toContain('build-tree-sitter-grammars.cjs');
expect(kotlinPkg.default.version).toBe('0.4.0-g1852ea1');
expect(kotlinPkg.default.version).toBe('0.4.0-gd6af96d');
// No scripts.install / dependencies inside vendor/ (#836 / #1728 hygiene).
expect(
(kotlinPkg.default as { scripts?: Record<string, string> }).scripts?.install,

View file

@ -0,0 +1,63 @@
import { describe, expect, it } from 'vitest';
import Parser from 'tree-sitter';
import { requireVendoredGrammar } from '../../src/core/tree-sitter/vendored-grammars.js';
const Kotlin = requireVendoredGrammar('tree-sitter-kotlin');
describe('vendored Kotlin grammar', () => {
it.each(['\n', '\n// comment\n', '\n/* comment */\n'])(
'preserves inheritance after trivia %j',
(trivia) => {
const parser = new Parser();
parser.setLanguage(Kotlin);
const tree = parser.parse(`class Child${trivia}: Parent() {}`);
expect(tree.rootNode.hasError).toBe(false);
expect(tree.rootNode.namedChildren.map((node) => node.type)).toEqual(['class_declaration']);
expect(
tree.rootNode.descendantsOfType('delegation_specifier').map((node) => node.text),
).toEqual(['Parent()']);
},
);
it.each(['\n', '\n// comment\n', '\n/* comment */\n'])(
'starts a callable reference statement after trivia %j',
(trivia) => {
const parser = new Parser();
parser.setLanguage(Kotlin);
const tree = parser.parse(`fun f() { foo()${trivia}::bar\n}`);
expect(tree.rootNode.hasError).toBe(false);
const statements = tree.rootNode.descendantsOfType('statements')[0];
expect(
statements.namedChildren
.filter((node) => !node.type.endsWith('_comment'))
.map((node) => [node.type, node.text]),
).toEqual([
['call_expression', 'foo()'],
['callable_reference', '::bar'],
]);
},
);
it('attaches a labeled trailing lambda across a newline', () => {
const parser = new Parser();
parser.setLanguage(Kotlin);
const tree = parser.parse('fun f() { foo()\nlabel@ { bar() }\n}');
expect(tree.rootNode.hasError).toBe(false);
const statements = tree.rootNode.descendantsOfType('statements')[0];
expect(statements.namedChildren.map((node) => node.type)).toEqual(['call_expression']);
expect(statements.namedChildren[0].text).toBe('foo()\nlabel@ { bar() }');
});
it('ends a line comment at a bare carriage return without losing the declaration', () => {
const parser = new Parser();
parser.setLanguage(Kotlin);
const tree = parser.parse('fun f() {\n// comment\rval x = 1\n}');
expect(tree.rootNode.hasError).toBe(false);
expect(tree.rootNode.descendantsOfType('line_comment').map((node) => node.text)).toEqual([
'// comment',
]);
expect(
tree.rootNode.descendantsOfType('property_declaration').map((node) => node.text),
).toEqual(['val x = 1']);
});
});

View file

@ -2,8 +2,8 @@
This directory is a GitNexus-managed minimal **runtime** package derived from
`tree-sitter-kotlin` (fwcd), pinned to the **unreleased `main` commit
[`c8ac3d26`](https://github.com/fwcd/tree-sitter-kotlin/commit/c8ac3d2627240160b999a2c100de3babbdb8f419)**
(`package.json` version `0.4.0`). It is pinned to `main` rather than
[`d6af96d2`](https://github.com/fwcd/tree-sitter-kotlin/commit/d6af96d2e23ef0a8ff5ab512864378cf08fba311)**
(`package.json` version `0.4.0-gd6af96d`). It is pinned to `main` rather than
a tagged release because the latest release, `0.3.8` (tagged 2024-08-03),
predates `fun interface` (functional/SAM interface) support: it parsed
`fun interface Foo` as an `ERROR` node and dropped the declaration. That fix
@ -40,12 +40,14 @@ Dart/Proto/Swift/Kotlin go through one uniform `kind: 'vendored'` build.
1. Bump the pin: update `version` in `package.json` (this is the value the
`build-tree-sitter-prebuilds` workflow diffs to decide whether to rebuild)
and refresh `_vendoredBy` with the new ref.
2. Refresh `bindings/node/*`, `src/parser.c`, `src/scanner.c`,
`src/node-types.json`, `src/tree_sitter/*`, and `binding.gyp` from the new
2. Refresh `bindings/node/binding.cc`, `src/parser.c`, `src/scanner.c`,
`src/node-types.json`, and `src/tree_sitter/*` from the new
upstream ref (a release tag, or — as now — a pinned `main` commit). For a
pinned commit the generated `parser.c` is committed upstream, so copy it
directly; if you re-pin to a ref that does not commit `parser.c`, regenerate
it with `tree-sitter generate` first.
it with `tree-sitter generate` first. Preserve the GitNexus CommonJS loader
and `binding.gyp`: its MSVC settings enable C11 for the scanner's static
assertions on Windows (`cflags_c` alone does not reach MSBuild).
3. Regenerate the six native prebuilds by running the
**`build-tree-sitter-prebuilds`** GitHub Actions workflow (it builds
`{linux,darwin,win32}-{x64,arm64}` from this vendored source and opens a PR

View file

@ -19,10 +19,18 @@
"-std=c11",
],
}, { # OS == "win"
"cflags_c": [
"/std:c11",
"/utf-8",
],
# cflags_c is not forwarded by the MSVS generator. The scanner's
# _Static_assert requires C11 even when the rest of the C compiles.
"msvs_settings": {
"VCCLCompilerTool": {
"LanguageStandard": "stdcpp20",
"LanguageStandard_C": "stdc11",
# Node headers also inject a raw C++ flag. MSBuild's language
# settings select the right standard for each .c / .cc source.
"AdditionalOptions!": ["-std:c++20", "/std:c++20"],
"AdditionalOptions": ["/utf-8"],
},
},
}],
],
}

View file

@ -1,12 +1,12 @@
{
"name": "tree-sitter-kotlin",
"version": "0.4.0-g1852ea1",
"version": "0.4.0-gd6af96d",
"description": "Kotlin grammar for tree-sitter",
"repository": "https://github.com/fwcd/tree-sitter-kotlin",
"license": "MIT",
"main": "bindings/node/index.js",
"types": "bindings/node/index.d.ts",
"_vendoredBy": "gitnexus — upstream generated src/ and bindings/node/binding.cc copied byte-for-byte from https://github.com/fwcd/tree-sitter-kotlin@1852ea17b7f60fb3f9d84e0b1555d56b46b39fb1. GitNexus keeps its synchronous CommonJS loader and hardened binding.gyp. Prebuilds are rebuilt from these sources by build-tree-sitter-prebuilds.yml. Do not edit generated C by hand.",
"_vendoredBy": "gitnexus - re-vendored from fwcd/tree-sitter-kotlin@d6af96d2e23ef0a8ff5ab512864378cf08fba311 by grammar-update-monitor on ABI 14. Source-build inputs (parser.c/scanner.c/src/) refreshed; the GitNexus-hardened binding.gyp + synchronous loader + vendor README + prebuilds are preserved (prebuilds are rebuilt by build-tree-sitter-prebuilds.yml on this version change). No scripts/dependencies here (#836/#1728).",
"peerDependencies": {
"tree-sitter": "0.25.1"
},
@ -15,5 +15,5 @@
"optional": true
}
},
"_upstreamCommit": "1852ea17b7f60fb3f9d84e0b1555d56b46b39fb1"
"_upstreamCommit": "d6af96d2e23ef0a8ff5ab512864378cf08fba311"
}

View file

@ -1,6 +1,6 @@
eead3dd8a0144a00fbc1564e27d86217c9134a83ed85a435933969652fcdb1d1 ./darwin-arm64/tree-sitter-kotlin.node
931c1d0844e857d7eb16e537bc3791e9e696f3e9074342c7920d11888371e6f9 ./darwin-x64/tree-sitter-kotlin.node
e450af11745811646af4be54c6e1ac69767184b878de790ee37e92546e4685d3 ./linux-arm64/tree-sitter-kotlin.node
220f109e4e2ce3f27e5889bd326cf7dc1ec83c5a99ec022f60f023c240fc52a8 ./linux-x64/tree-sitter-kotlin.node
ea26652d30ac4e75a16ec8fca7194bfe0324c96d169f5ccbdf1fde42ed99de83 ./win32-arm64/tree-sitter-kotlin.node
c2b049fe147f40df5546163c07c50cbfcdb1e0dbe348cd003a998e47a61307bb ./win32-x64/tree-sitter-kotlin.node
351bc0206e2eb21b820f6bcf127721818ce0487d7ec7078d66eb4c959496969a ./darwin-arm64/tree-sitter-kotlin.node
b2e691decd540477cf1ba413686f13055f5200e7078b2cb27984982a3f2eb560 ./darwin-x64/tree-sitter-kotlin.node
9402e5905b951b1f6082cb1b5edebf0d480ef98385b8111e65a176a8738446bc ./linux-arm64/tree-sitter-kotlin.node
caa57cf546a382252720df835f96554b5e609359b517dfffa6beedcb1edb90ea ./linux-x64/tree-sitter-kotlin.node
4d96fcd4564c6512fba54439d6a4e93dc7db4c673a3dea7221ceb1b70d23ca9f ./win32-arm64/tree-sitter-kotlin.node
dcf3e3e5903f59a892260fd6ea92842f0c947ba8111402d24105ebc61c1da3be ./win32-x64/tree-sitter-kotlin.node

View file

@ -170,6 +170,37 @@
]
}
},
{
"type": "annotated_expression",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "annotation",
"named": true
},
{
"type": "assignment",
"named": true
},
{
"type": "do_while_statement",
"named": true
},
{
"type": "for_statement",
"named": true
},
{
"type": "while_statement",
"named": true
}
]
}
},
{
"type": "annotated_lambda",
"named": true,
@ -224,6 +255,10 @@
"multiple": true,
"required": true,
"types": [
{
"type": "context_receiver",
"named": true
},
{
"type": "function_body",
"named": true
@ -260,6 +295,10 @@
"type": "type_modifiers",
"named": true
},
{
"type": "type_parameters",
"named": true
},
{
"type": "user_type",
"named": true
@ -272,9 +311,13 @@
"named": true,
"fields": {},
"children": {
"multiple": false,
"multiple": true,
"required": false,
"types": [
{
"type": "modifiers",
"named": true
},
{
"type": "statements",
"named": true
@ -652,6 +695,205 @@
]
}
},
{
"type": "backing_field",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "additive_expression",
"named": true
},
{
"type": "anonymous_function",
"named": true
},
{
"type": "as_expression",
"named": true
},
{
"type": "bin_literal",
"named": true
},
{
"type": "boolean_literal",
"named": true
},
{
"type": "call_expression",
"named": true
},
{
"type": "callable_reference",
"named": true
},
{
"type": "character_literal",
"named": true
},
{
"type": "check_expression",
"named": true
},
{
"type": "collection_literal",
"named": true
},
{
"type": "comparison_expression",
"named": true
},
{
"type": "conjunction_expression",
"named": true
},
{
"type": "disjunction_expression",
"named": true
},
{
"type": "elvis_expression",
"named": true
},
{
"type": "equality_expression",
"named": true
},
{
"type": "function_type",
"named": true
},
{
"type": "hex_literal",
"named": true
},
{
"type": "if_expression",
"named": true
},
{
"type": "indexing_expression",
"named": true
},
{
"type": "infix_expression",
"named": true
},
{
"type": "integer_literal",
"named": true
},
{
"type": "jump_expression",
"named": true
},
{
"type": "lambda_literal",
"named": true
},
{
"type": "long_literal",
"named": true
},
{
"type": "modifiers",
"named": true
},
{
"type": "multiplicative_expression",
"named": true
},
{
"type": "navigation_expression",
"named": true
},
{
"type": "not_nullable_type",
"named": true
},
{
"type": "null_literal",
"named": true
},
{
"type": "nullable_type",
"named": true
},
{
"type": "object_literal",
"named": true
},
{
"type": "parenthesized_expression",
"named": true
},
{
"type": "parenthesized_type",
"named": true
},
{
"type": "postfix_expression",
"named": true
},
{
"type": "prefix_expression",
"named": true
},
{
"type": "range_expression",
"named": true
},
{
"type": "real_literal",
"named": true
},
{
"type": "simple_identifier",
"named": true
},
{
"type": "spread_expression",
"named": true
},
{
"type": "string_literal",
"named": true
},
{
"type": "super_expression",
"named": true
},
{
"type": "this_expression",
"named": true
},
{
"type": "try_expression",
"named": true
},
{
"type": "type_modifiers",
"named": true
},
{
"type": "unsigned_literal",
"named": true
},
{
"type": "user_type",
"named": true
},
{
"type": "when_expression",
"named": true
}
]
}
},
{
"type": "binding_pattern_kind",
"named": true,
@ -868,6 +1110,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "quest",
"named": true
},
{
"type": "simple_identifier",
"named": true
@ -1204,6 +1450,10 @@
"multiple": true,
"required": true,
"types": [
{
"type": "annotation",
"named": true
},
{
"type": "class_body",
"named": true
@ -1626,6 +1876,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "annotation",
"named": true
},
{
"type": "class_body",
"named": true
@ -2021,6 +2275,49 @@
]
}
},
{
"type": "context_receiver",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "function_type",
"named": true
},
{
"type": "not_nullable_type",
"named": true
},
{
"type": "nullable_type",
"named": true
},
{
"type": "parameter",
"named": true
},
{
"type": "parameter_modifiers",
"named": true
},
{
"type": "parenthesized_type",
"named": true
},
{
"type": "type_modifiers",
"named": true
},
{
"type": "user_type",
"named": true
}
]
}
},
{
"type": "control_structure_body",
"named": true,
@ -2033,6 +2330,10 @@
"type": "additive_expression",
"named": true
},
{
"type": "annotated_expression",
"named": true
},
{
"type": "annotation",
"named": true
@ -3536,12 +3837,16 @@
"fields": {},
"children": {
"multiple": true,
"required": true,
"required": false,
"types": [
{
"type": "constructor_invocation",
"named": true
},
{
"type": "use_site_target",
"named": true
},
{
"type": "user_type",
"named": true
@ -4114,6 +4419,10 @@
"type": "bin_literal",
"named": true
},
{
"type": "binding_pattern_kind",
"named": true
},
{
"type": "boolean_literal",
"named": true
@ -5727,6 +6036,10 @@
"type": "class_modifier",
"named": true
},
{
"type": "context_receiver",
"named": true
},
{
"type": "function_modifier",
"named": true
@ -6127,6 +6440,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "lambda_literal",
"named": true
},
{
"type": "parenthesized_expression",
"named": true
@ -6196,6 +6513,10 @@
"multiple": true,
"required": true,
"types": [
{
"type": "annotation",
"named": true
},
{
"type": "class_body",
"named": true
@ -6208,9 +6529,17 @@
"type": "modifiers",
"named": true
},
{
"type": "primary_constructor",
"named": true
},
{
"type": "type_identifier",
"named": true
},
{
"type": "type_parameters",
"named": true
}
]
}
@ -6223,6 +6552,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "annotation",
"named": true
},
{
"type": "class_body",
"named": true
@ -6239,12 +6572,16 @@
"named": true,
"fields": {},
"children": {
"multiple": false,
"multiple": true,
"required": true,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "modifiers",
"named": true
}
]
}
@ -6985,6 +7322,10 @@
"type": "as_expression",
"named": true
},
{
"type": "backing_field",
"named": true
},
{
"type": "bin_literal",
"named": true
@ -7698,6 +8039,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "function_type",
"named": true
},
{
"type": "nullable_type",
"named": true
@ -7819,6 +8164,10 @@
"type": "additive_expression",
"named": true
},
{
"type": "annotated_expression",
"named": true
},
{
"type": "annotation",
"named": true
@ -8233,6 +8582,10 @@
"type": "additive_expression",
"named": true
},
{
"type": "annotated_expression",
"named": true
},
{
"type": "annotation",
"named": true
@ -8696,6 +9049,10 @@
{
"type": "annotation",
"named": true
},
{
"type": "context_receiver",
"named": true
}
]
}
@ -8755,6 +9112,34 @@
"type": "annotation",
"named": true
},
{
"type": "class_modifier",
"named": true
},
{
"type": "function_modifier",
"named": true
},
{
"type": "inheritance_modifier",
"named": true
},
{
"type": "member_modifier",
"named": true
},
{
"type": "parameter_modifier",
"named": true
},
{
"type": "platform_modifier",
"named": true
},
{
"type": "property_modifier",
"named": true
},
{
"type": "reification_modifier",
"named": true
@ -8762,6 +9147,10 @@
{
"type": "variance_modifier",
"named": true
},
{
"type": "visibility_modifier",
"named": true
}
]
}
@ -9384,7 +9773,18 @@
{
"type": "when_subject",
"named": true,
"fields": {},
"fields": {
"receiver": {
"multiple": false,
"required": false,
"types": [
{
"type": "receiver_type",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": false,
@ -9485,6 +9885,10 @@
"type": "long_literal",
"named": true
},
{
"type": "multi_variable_declaration",
"named": true
},
{
"type": "multiplicative_expression",
"named": true
@ -9895,10 +10299,6 @@
"type": "@",
"named": false
},
{
"type": "L",
"named": false
},
{
"type": "[",
"named": false
@ -9919,6 +10319,10 @@
"type": "actual",
"named": false
},
{
"type": "all",
"named": false
},
{
"type": "annotation",
"named": false
@ -9967,6 +10371,10 @@
"type": "constructor",
"named": false
},
{
"type": "context",
"named": false
},
{
"type": "continue",
"named": false

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff