File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,6 +256,18 @@ bool tree_sitter_rescript_external_scanner_scan(
256256 }
257257 }
258258 }
259+ } else if (lexer -> lookahead == 'w' ) {
260+ advance (lexer );
261+ if (lexer -> lookahead == 'i' ) {
262+ advance (lexer );
263+ if (lexer -> lookahead == 't' ) {
264+ advance (lexer );
265+ if (lexer -> lookahead == 'h' ) {
266+ // Ignore new lines before `with` keyword (module type constraints)
267+ in_multiline_statement = true;
268+ }
269+ }
270+ }
259271 }
260272
261273 if (in_multiline_statement ) {
Original file line number Diff line number Diff line change @@ -747,6 +747,66 @@ module M = (Na: N, Nb: N): (
747747 (type_identifier)))))
748748 body: (block)))))
749749
750+ ================================================================================
751+ Module with type constraint
752+ ================================================================================
753+
754+ module LogResultDecoder: OnpingStdLib_PubSub.FromJSON
755+ with type t = AlarmMixLogBatchTypes.batchResult = {
756+ type t = AlarmMixLogBatchTypes.batchResult
757+ let fromJSON = (json: JSON.t): result<t, string> => {
758+ AlarmMixLogBatchTypes.decodeBatchResult(json)
759+ }
760+ }
761+
762+ --------------------------------------------------------------------------------
763+
764+ (source_file
765+ (module_declaration
766+ (module_binding
767+ name: (module_identifier)
768+ signature: (module_type_constraint
769+ (module_identifier_path
770+ (module_identifier)
771+ (module_identifier))
772+ (constrain_type
773+ (type_identifier)
774+ (type_identifier_path
775+ (module_identifier)
776+ (type_identifier))))
777+ definition: (block
778+ (type_declaration
779+ (type_binding
780+ name: (type_identifier)
781+ (type_identifier_path
782+ (module_identifier)
783+ (type_identifier))))
784+ (let_declaration
785+ (let_binding
786+ pattern: (value_identifier)
787+ body: (function
788+ parameters: (formal_parameters
789+ (parameter
790+ (value_identifier)
791+ (type_annotation
792+ (type_identifier_path
793+ (module_identifier)
794+ (type_identifier)))))
795+ return_type: (type_annotation
796+ (generic_type
797+ (type_identifier)
798+ (type_arguments
799+ (type_identifier)
800+ (type_identifier))))
801+ body: (block
802+ (expression_statement
803+ (call_expression
804+ function: (value_identifier_path
805+ (module_identifier)
806+ (value_identifier))
807+ arguments: (arguments
808+ (value_identifier))))))))))))
809+
750810================================================================================
751811Dynamic imports
752812================================================================================
You can’t perform that action at this time.
0 commit comments