├── tests ├── parsing │ ├── other │ │ ├── emptyFile.res │ │ ├── emptyInterface.resi │ │ ├── expected │ │ │ ├── emptyFile.res.txt │ │ │ ├── emptyInterface.resi.txt │ │ │ ├── comments.res.txt │ │ │ ├── onlyMultilineComment.res.txt │ │ │ ├── onlyMultilineComment.resi.txt │ │ │ ├── onlySinglelineComment.res.txt │ │ │ ├── onlySinglinelineComment.resi.txt │ │ │ ├── singleLineCommentWithoutNewline.res.txt │ │ │ ├── semi.res.txt │ │ │ ├── list.res.txt │ │ │ ├── attributes.res.txt │ │ │ └── docComments.res.txt │ │ ├── semi.res │ │ ├── onlySinglelineComment.res │ │ ├── onlySinglinelineComment.resi │ │ ├── singleLineCommentWithoutNewline.res │ │ ├── onlyMultilineComment.res │ │ ├── onlyMultilineComment.resi │ │ ├── comments.res │ │ ├── gentype.res │ │ ├── list.res │ │ ├── attributes.res │ │ └── docComments.res │ ├── errors │ │ ├── expressions │ │ │ ├── id.res │ │ │ ├── emptyeof.res │ │ │ ├── misc.res │ │ │ ├── taggedTemplateLiterals.res │ │ │ ├── emptyBlock.res │ │ │ ├── expected │ │ │ │ ├── emptyBlock.res.txt │ │ │ │ ├── stringLiteral.res.txt │ │ │ │ ├── object.res.txt │ │ │ │ ├── id.res.txt │ │ │ │ ├── misc.res.txt │ │ │ │ ├── emptyeof.res.txt │ │ │ │ ├── if.res.txt │ │ │ │ ├── array.res.txt │ │ │ │ ├── taggedTemplateLiterals.res.txt │ │ │ │ ├── try.res.txt │ │ │ │ └── arrow.res.txt │ │ │ ├── stringLiteral.res │ │ │ ├── array.res │ │ │ ├── if.res │ │ │ ├── object.res │ │ │ ├── try.res │ │ │ ├── arrow.res │ │ │ ├── unexpectedConstraint.res │ │ │ ├── ambiguousArrow.res │ │ │ ├── setField.res │ │ │ ├── implementation.res │ │ │ ├── jsx.res │ │ │ ├── letBinding.res │ │ │ ├── consecutive.res │ │ │ ├── ifLet.res │ │ │ └── record.res │ │ ├── other │ │ │ ├── for.res │ │ │ ├── patternMatching.res │ │ │ ├── hashIdent.res │ │ │ ├── labelledParameters.res │ │ │ ├── oneElementTuple.res │ │ │ ├── expected │ │ │ │ ├── patternMatching.res.txt │ │ │ │ └── for.res.txt │ │ │ ├── regionMissingComma.res │ │ │ ├── spread.res │ │ │ └── breadcrumbs170.res │ │ ├── typeDef │ │ │ ├── keywordOnly.res │ │ │ ├── emptyRecord.res │ │ │ ├── expected │ │ │ │ ├── emptyRecord.res.txt │ │ │ │ ├── keywordOnly.res.txt │ │ │ │ ├── namedParameters.res.txt │ │ │ │ ├── record.res.txt │ │ │ │ └── emptyInlineRecord.res.txt │ │ │ ├── namedParameters.res │ │ │ ├── emptyInlineRecord.res │ │ │ ├── record.res │ │ │ ├── polyvariant.res │ │ │ └── inlineRecord.res │ │ ├── scanner │ │ │ ├── badCharacter.res │ │ │ ├── nativeint.res │ │ │ ├── unclosedString.res │ │ │ ├── exoticIdent.res │ │ │ ├── unclosedComment.res │ │ │ ├── escapeSequence.res │ │ │ ├── expected │ │ │ │ ├── escapeSequence.res.txt │ │ │ │ ├── nativeint.res.txt │ │ │ │ ├── unclosedComment.res.txt │ │ │ │ └── unclosedString.res.txt │ │ │ └── oldDerefOp.res │ │ ├── structure │ │ │ ├── consecutive.res │ │ │ ├── letBindingPatternKeyword.res │ │ │ ├── closingBraces.res │ │ │ ├── attributes.res │ │ │ ├── external.res │ │ │ ├── gh16A.res │ │ │ └── expected │ │ │ │ ├── consecutive.res.txt │ │ │ │ ├── closingBraces.res.txt │ │ │ │ ├── external.res.txt │ │ │ │ └── gh16A.res.txt │ │ ├── typexpr │ │ │ ├── typeVar.res │ │ │ ├── garbage.res │ │ │ ├── objectSpread.res │ │ │ ├── typeConstructorArgs.res │ │ │ ├── arrow.res │ │ │ └── expected │ │ │ │ └── garbage.res.txt │ │ ├── signature │ │ │ ├── closingBraces.resi │ │ │ ├── attributes.resi │ │ │ └── expected │ │ │ │ └── closingBraces.resi.txt │ │ └── pattern │ │ │ ├── missing.res │ │ │ └── templateLiteral.res │ ├── recovery │ │ ├── string │ │ │ ├── emptyeof.res │ │ │ ├── eof.res │ │ │ ├── unclosed.res │ │ │ ├── expected │ │ │ │ ├── unclosed.res.txt │ │ │ │ ├── emptyeof.res.txt │ │ │ │ └── eof.res.txt │ │ │ └── es6template.res │ │ ├── comments │ │ │ ├── eof.res │ │ │ └── expected │ │ │ │ └── eof.res.txt │ │ ├── expression │ │ │ ├── jsx.res │ │ │ ├── emptyBlock.res │ │ │ ├── expected │ │ │ │ ├── emptyBlock.res.txt │ │ │ │ ├── infinite.res.txt │ │ │ │ └── jsx.res.txt │ │ │ ├── infinite.res │ │ │ ├── if.res │ │ │ └── list.res │ │ ├── structure │ │ │ ├── letBinding.res │ │ │ └── expected │ │ │ │ └── letBinding.res.txt │ │ ├── pattern │ │ │ ├── array.res │ │ │ ├── tuple.res │ │ │ ├── record.res │ │ │ ├── list.res │ │ │ ├── constrained.res │ │ │ ├── constructor.res │ │ │ ├── parenthesized.res │ │ │ ├── polyvariant.res │ │ │ └── expected │ │ │ │ └── constrained.res.txt │ │ ├── typeDef │ │ │ ├── typeParams.res │ │ │ └── expected │ │ │ │ └── typeParams.res.txt │ │ └── typexpr │ │ │ ├── typeConstructorArgs.res │ │ │ └── expected │ │ │ └── typeConstructorArgs.res.txt │ ├── grammar │ │ ├── pattern │ │ │ ├── var.res │ │ │ ├── expected │ │ │ │ ├── var.res.txt │ │ │ │ └── or.res.txt │ │ │ └── or.res │ │ ├── typexpr │ │ │ ├── any.res │ │ │ ├── expected │ │ │ │ ├── any.res.txt │ │ │ │ ├── parenthesized.res.txt │ │ │ │ ├── var.res.txt │ │ │ │ ├── tuple.res.txt │ │ │ │ ├── extension.res.txt │ │ │ │ ├── poly.res.txt │ │ │ │ ├── unit.res.txt │ │ │ │ └── bsObject.res.txt │ │ │ ├── parenthesized.res │ │ │ ├── var.res │ │ │ ├── tuple.res │ │ │ ├── poly.res │ │ │ ├── extension.res │ │ │ ├── unit.res │ │ │ └── bsObject.res │ │ ├── interface │ │ │ ├── interface.resi │ │ │ └── expected │ │ │ │ └── interface.resi.txt │ │ ├── typedefinition │ │ │ ├── expected │ │ │ │ ├── diamond.res.txt │ │ │ │ ├── typeNonrec.res.txt │ │ │ │ ├── bsObject.res.txt │ │ │ │ ├── typeparams.res.txt │ │ │ │ ├── typeConstraint.res.txt │ │ │ │ ├── typedef.res.txt │ │ │ │ └── typeDefinition.res.txt │ │ │ ├── diamond.res │ │ │ ├── bsObject.res │ │ │ ├── typeNonrec.res │ │ │ ├── typeparams.res │ │ │ ├── typeConstraint.res │ │ │ ├── typedef.res │ │ │ └── typeDefinition.res │ │ ├── modexpr │ │ │ ├── constrained.res │ │ │ ├── expected │ │ │ │ ├── constrained.res.txt │ │ │ │ ├── structure.res.txt │ │ │ │ ├── ident.res.txt │ │ │ │ └── parenthesized.res.txt │ │ │ ├── structure.res │ │ │ ├── ident.res │ │ │ └── parenthesized.res │ │ ├── structure │ │ │ ├── module.res │ │ │ ├── modType.res │ │ │ ├── expected │ │ │ │ ├── modType.res.txt │ │ │ │ ├── includeStatement.res.txt │ │ │ │ ├── module.res.txt │ │ │ │ ├── openDescription.res.txt │ │ │ │ ├── standaloneAttribute.res.txt │ │ │ │ ├── itemExtension.res.txt │ │ │ │ ├── typeDefinition.res.txt │ │ │ │ ├── modExprExtension.res.txt │ │ │ │ ├── moduleTypeExtension.res.txt │ │ │ │ ├── recursiveModules.res.txt │ │ │ │ └── letBinding.res.txt │ │ │ ├── includeStatement.res │ │ │ ├── openDescription.res │ │ │ ├── standaloneAttribute.res │ │ │ ├── typeDefinition.res │ │ │ ├── itemExtension.res │ │ │ ├── modExprExtension.res │ │ │ ├── moduleTypeExtension.res │ │ │ ├── recursiveModules.res │ │ │ └── letBinding.res │ │ ├── expressions │ │ │ ├── coerce.res │ │ │ ├── expected │ │ │ │ ├── coerce.res.txt │ │ │ │ ├── float.res.txt │ │ │ │ ├── array.res.txt │ │ │ │ ├── tuple.res.txt │ │ │ │ ├── infix.res.txt │ │ │ │ ├── unary.res.txt │ │ │ │ ├── tupleVsDivision.res.txt │ │ │ │ ├── constructor.res.txt │ │ │ │ ├── while.res.txt │ │ │ │ ├── for.res.txt │ │ │ │ ├── extension.res.txt │ │ │ │ ├── ident.res.txt │ │ │ │ ├── list.res.txt │ │ │ │ ├── polyvariant.res.txt │ │ │ │ ├── try.res.txt │ │ │ │ ├── apply.res.txt │ │ │ │ └── if.res.txt │ │ │ ├── float.res │ │ │ ├── infix.res │ │ │ ├── unary.res │ │ │ ├── array.res │ │ │ ├── tuple.res │ │ │ ├── tupleVsDivision.res │ │ │ ├── extension.res │ │ │ ├── while.res │ │ │ ├── constructor.res │ │ │ ├── ident.res │ │ │ ├── apply.res │ │ │ ├── polyvariant.res │ │ │ ├── for.res │ │ │ ├── argument.res │ │ │ ├── try.res │ │ │ └── uncurried.res │ │ ├── signature │ │ │ ├── expected │ │ │ │ ├── let.res.txt │ │ │ │ ├── typLvlModAlias.res.txt │ │ │ │ ├── standAloneAttribute.res.txt │ │ │ │ ├── itemExtension.res.txt │ │ │ │ ├── typeDefinition.res.txt │ │ │ │ ├── open.res.txt │ │ │ │ ├── modDecl.res.txt │ │ │ │ ├── modtype.res.txt │ │ │ │ └── external.res.txt │ │ │ ├── let.res │ │ │ ├── standAloneAttribute.res │ │ │ ├── typLvlModAlias.res │ │ │ ├── itemExtension.res │ │ │ ├── typeDefinition.res │ │ │ ├── open.res │ │ │ ├── modDecl.res │ │ │ ├── modtype.res │ │ │ └── external.res │ │ └── modtype │ │ │ ├── extension.res │ │ │ ├── expected │ │ │ ├── extension.res.txt │ │ │ ├── signature.res.txt │ │ │ ├── ident.res.txt │ │ │ └── typeof.res.txt │ │ │ ├── signature.res │ │ │ ├── typeof.res │ │ │ └── ident.res │ └── infiniteLoops │ │ ├── polymorphicVariantType.res │ │ ├── templateEof.res │ │ ├── jsxChildren.res │ │ └── expected │ │ └── polymorphicVariantType.res.txt ├── printer │ ├── pattern │ │ ├── any.res │ │ ├── expected │ │ │ ├── any.res.txt │ │ │ ├── extension.res.txt │ │ │ ├── alias.res.txt │ │ │ ├── lazy.res.txt │ │ │ ├── array.res.txt │ │ │ ├── exception.res.txt │ │ │ ├── var.res.txt │ │ │ ├── interval.res.txt │ │ │ ├── tuple.res.txt │ │ │ ├── exoticIdent.res.txt │ │ │ ├── firstClassModules.res.txt │ │ │ ├── type.res.txt │ │ │ └── list.res.txt │ │ ├── extension.res │ │ ├── alias.res │ │ ├── lazy.res │ │ ├── array.res │ │ ├── exception.res │ │ ├── var.res │ │ ├── interval.res │ │ ├── tuple.res │ │ ├── exoticIdent.res │ │ ├── firstClassModules.res │ │ ├── type.res │ │ ├── list.res │ │ └── constraint.res │ ├── other │ │ ├── lor.res │ │ ├── expected │ │ │ ├── lor.res.txt │ │ │ ├── reasonInterfaceFile.resi.txt │ │ │ ├── comments.res.txt │ │ │ ├── reasonFile.res.txt │ │ │ ├── reasonString.res.txt │ │ │ ├── char.res.txt │ │ │ ├── reasonArity.res.txt │ │ │ └── string.res.txt │ │ ├── reasonInterfaceFile.resi │ │ ├── comments.res │ │ ├── reasonFile.res │ │ ├── reasonString.res │ │ ├── char.res │ │ ├── reasonArity.res │ │ └── string.res │ ├── modExpr │ │ ├── extension.res │ │ ├── expected │ │ │ ├── extension.res.txt │ │ │ └── structure.res.txt │ │ └── structure.res │ ├── structure │ │ ├── moduleTypeDeclaration.res │ │ ├── expected │ │ │ ├── moduleTypeDeclaration.res.txt │ │ │ ├── open.res.txt │ │ │ ├── moduleBinding.res.txt │ │ │ ├── attribute.res.txt │ │ │ ├── type.res.txt │ │ │ ├── external.res.txt │ │ │ ├── extension.res.txt │ │ │ └── recModules.res.txt │ │ ├── open.res │ │ ├── moduleBinding.res │ │ ├── attribute.res │ │ ├── type.res │ │ ├── external.res │ │ ├── recModules.res │ │ └── extension.res │ ├── comments │ │ ├── fileWithOneSingleLineComment.res │ │ ├── interfaceWithOneSingleComment.resi │ │ ├── whitespaceCase2.res │ │ ├── expected │ │ │ ├── whitespaceCase2.res.txt │ │ │ ├── fileWithOneSingleLineComment.res.txt │ │ │ ├── interfaceWithOneSingleComment.resi.txt │ │ │ ├── interfaceWithOnlyComments.resi.txt │ │ │ ├── whitespaceCase1.res.txt │ │ │ ├── fileWithOnlyComments.res.txt │ │ │ ├── ifThenElse.res.txt │ │ │ ├── openDescription.res.txt │ │ │ ├── structure2.res.txt │ │ │ ├── valueBindingSugar.res.txt │ │ │ ├── structure3.res.txt │ │ │ └── whitespaceTrailingLeading.res.txt │ │ ├── interfaceWithOnlyComments.resi │ │ ├── whitespaceCase1.res │ │ ├── fileWithOnlyComments.res │ │ ├── ifThenElse.res │ │ ├── openDescription.res │ │ ├── structure2.res │ │ ├── valueBindingSugar.res │ │ ├── structure3.res │ │ └── whitespaceTrailingLeading.res │ ├── expr │ │ ├── letmodule.res │ │ ├── letexception.res │ │ ├── expected │ │ │ ├── letmodule.res.txt │ │ │ ├── letexception.res.txt │ │ │ ├── sequence.res.txt │ │ │ ├── open.res.txt │ │ │ ├── constant.res.txt │ │ │ ├── arraySet.res.txt │ │ │ ├── pipe.res.txt │ │ │ ├── ident.res.txt │ │ │ ├── constraint.res.txt │ │ │ ├── for.res.txt │ │ │ ├── jsObjectSet.res.txt │ │ │ └── jsObjectAccess.res.txt │ │ ├── open.res │ │ ├── sequence.res │ │ ├── arraySet.res │ │ ├── constant.res │ │ ├── pipe.res │ │ ├── for.res │ │ ├── ident.res │ │ ├── constraint.res │ │ ├── jsObjectSet.res │ │ ├── jsObjectAccess.res │ │ └── nestedCallbacks.res │ ├── modType │ │ ├── extension.res │ │ ├── expected │ │ │ ├── extension.res.txt │ │ │ ├── moduleTypeOf.res.txt │ │ │ ├── ident.res.txt │ │ │ └── exoticIdent.res.txt │ │ ├── moduleTypeOf.res │ │ ├── ident.res │ │ └── exoticIdent.res │ ├── signature │ │ ├── open.resi │ │ ├── typext.resi │ │ ├── extension.resi │ │ ├── expected │ │ │ ├── extension.resi.txt │ │ │ ├── open.resi.txt │ │ │ ├── typext.resi.txt │ │ │ ├── include.resi.txt │ │ │ ├── type.resi.txt │ │ │ ├── value.resi.txt │ │ │ ├── attributes.resi.txt │ │ │ └── exception.resi.txt │ │ ├── include.resi │ │ ├── value.resi │ │ ├── type.resi │ │ ├── attributes.resi │ │ └── exception.resi │ ├── typeDef │ │ ├── constraint.res │ │ ├── expected │ │ │ ├── constraint.res.txt │ │ │ ├── open.res.txt │ │ │ └── exoticIdent.res.txt │ │ ├── open.res │ │ └── exoticIdent.res │ └── typexpr │ │ ├── alias.res │ │ ├── expected │ │ ├── alias.res.txt │ │ ├── extension.res.txt │ │ ├── var.res.txt │ │ ├── exoticIdent.res.txt │ │ ├── polyTyp.res.txt │ │ └── any.res.txt │ │ ├── extension.res │ │ ├── var.res │ │ ├── exoticIdent.res │ │ ├── any.res │ │ └── polyTyp.res ├── conversion │ └── reason │ │ ├── refSugar.ml │ │ ├── ternary.res │ │ ├── variant.res │ │ ├── gentype.resi │ │ ├── letprivate.res │ │ ├── refSugarReason.res │ │ ├── expected │ │ ├── refSugar.ml.txt │ │ ├── ternary.res.txt │ │ ├── variant.res.txt │ │ ├── gentype.resi.txt │ │ ├── letprivate.res.txt │ │ ├── refSugarReason.res.txt │ │ ├── underscoreSugar.res.txt │ │ ├── unicode.res.txt │ │ ├── moduleLanguage.res.txt │ │ ├── recursiveType.ml.txt │ │ ├── extension.res.txt │ │ ├── docComments.res.txt │ │ ├── object.ml.txt │ │ ├── jsObject.resi.txt │ │ ├── singleLineComments.res.txt │ │ └── gentype.res.txt │ │ ├── underscoreSugar.res │ │ ├── unicode.res │ │ ├── moduleLanguage.res │ │ ├── recursiveType.ml │ │ ├── extension.res │ │ ├── docComments.res │ │ ├── object.ml │ │ ├── jsObject.resi │ │ ├── singleLineComments.res │ │ └── gentype.res ├── api │ ├── reiSyntax.resi │ ├── resiSyntax.resi │ ├── mliSyntax.mli │ ├── resSyntax.res │ ├── resReactJsx.res │ ├── mlSyntax.ml │ └── reasonSyntax.res ├── idempotency │ ├── pupilfirst │ │ ├── shared │ │ │ ├── Icon.res │ │ │ ├── Date.res │ │ │ ├── Loading.res │ │ │ ├── FaIcon.res │ │ │ ├── GraphqlQuery.resi │ │ │ ├── WindowUtils.res │ │ │ ├── DateTime.resi │ │ │ ├── PrismJs.res │ │ │ ├── ScrollLock.res │ │ │ └── EmailUtils.res │ │ ├── schools │ │ │ ├── CourseAuthors__Types.res │ │ │ ├── CourseEditor__Types.res │ │ │ ├── CoachesSchoolIndex__Types.res │ │ │ ├── SchoolCustomize__Types.res │ │ │ ├── InactiveStudentsPanel__Types.res │ │ │ ├── StudentsEditor__Coach.resi │ │ │ ├── InactiveStudentsPanel__Team.resi │ │ │ ├── CourseExports__Types.res │ │ │ ├── CourseCoaches__Types.res │ │ │ ├── CurriculumEditor__Course.res │ │ │ ├── SchoolCommunities__IndexTypes.res │ │ │ ├── InactiveStudentsPanel__Student.resi │ │ │ ├── CourseExports__Course.res │ │ │ ├── StudentsEditor__Level.resi │ │ │ ├── SchoolCustomize__UpdateSchoolStringError.res │ │ │ ├── StudentsEditor__Coach.res │ │ │ ├── CourseCoaches__SchoolCoach.res │ │ │ ├── InactiveStudentsPanel__Team.res │ │ │ ├── CourseExports__Tag.res │ │ │ ├── CurriculumEditor__EvaluationCriteria.res │ │ │ └── StudentsEditor__Types.res │ │ ├── layouts │ │ │ ├── StudentTopNav__Types.res │ │ │ ├── SchoolAdminNavbar__Types.res │ │ │ ├── StudentCourse__Course.res │ │ │ └── StudentTopNav__NavLink.res │ │ ├── packs │ │ │ └── SchoolsCoursesIndexPack.res │ │ ├── users │ │ │ ├── UsersHome__Types.res │ │ │ └── UsersHome__Community.res │ │ ├── courses │ │ │ ├── CoursesStudents__Grade.res │ │ │ ├── CoursesStudents__Course.res │ │ │ ├── CoursesStudents__Submissions.res │ │ │ ├── CoursesReview__Student.res │ │ │ ├── CoursesCurriculum__Learn.res │ │ │ ├── CoursesCurriculum__Coach.res │ │ │ └── CoursesStudents__Teams.res │ │ ├── questions │ │ │ ├── QuestionsShow__LinkedTarget.res │ │ │ ├── QuestionsShow__Target.res │ │ │ └── QuestionsShow__Types.res │ │ └── packages │ │ │ └── PfIcon.res │ ├── bs-webapi │ │ ├── src │ │ │ └── Webapi │ │ │ │ ├── Webapi__Performance.res │ │ │ │ ├── Webapi__Base64.res │ │ │ │ ├── Webapi__Dom │ │ │ │ ├── Webapi__Dom__NodeFilter.res │ │ │ │ ├── Webapi__Dom__ChildNode.res │ │ │ │ ├── Webapi__Dom__DocumentOrShadowRoot.res │ │ │ │ ├── Webapi__Dom__Slotable.res │ │ │ │ ├── Webapi__Dom__NonElementParentNode.res │ │ │ │ ├── Webapi__Dom__CustomEvent.res │ │ │ │ ├── Webapi__Dom__PopStateEvent.res │ │ │ │ ├── Webapi__Dom__NonDocumentTypeChildNode.res │ │ │ │ ├── Webapi__Dom__BeforeUnloadEvent.res │ │ │ │ ├── Webapi__Dom__ClipboardEvent.res │ │ │ │ ├── Webapi__Dom__WebGlContextEvent.res │ │ │ │ ├── Webapi__Dom__PageTransitionEvent.res │ │ │ │ ├── Webapi__Dom__RelatedEvent.res │ │ │ │ ├── Webapi__Dom__DocumentFragment.res │ │ │ │ ├── Webapi__Dom__NodeList.res │ │ │ │ ├── Webapi__Dom__TrackEvent.res │ │ │ │ ├── Webapi__Dom__MutationObserver.res │ │ │ │ ├── Webapi__Dom__CloseEvent.res │ │ │ │ ├── Webapi__Dom__TimeEvent.res │ │ │ │ ├── Webapi__Dom__CompositionEvent.res │ │ │ │ ├── Webapi__Dom__HtmlCollection.res │ │ │ │ └── Webapi__Dom__IdbVersionChangeEvent.res │ │ │ │ ├── Webapi__ResizeObserver │ │ │ │ └── Webapi__ResizeObserver__ResizeObserverEntry.res │ │ │ │ └── Webapi__File.res │ │ └── tests │ │ │ ├── Webapi │ │ │ ├── Webapi__Base64__test.res │ │ │ ├── Webapi__Performace__test.res │ │ │ ├── Webapi__Url__test.res │ │ │ └── Webapi__Dom │ │ │ │ ├── Webapi__Dom__Text__test.res │ │ │ │ ├── Webapi__Dom__NodeList__test.res │ │ │ │ ├── Webapi__Dom__Image__test.res │ │ │ │ └── Webapi__Dom__DomStringMap__test.res │ │ │ └── testHelpers.res │ ├── ludum-dare-46 │ │ └── IndexHot.res │ ├── reasongl │ │ └── ReasonglInterface.res │ ├── covid-19charts.com │ │ └── src │ │ │ ├── CopyToClipboard.res │ │ │ ├── Location.res │ │ │ ├── ColorStack.resi │ │ │ ├── Colors.res │ │ │ ├── Window.res │ │ │ └── DatePicker.res │ ├── nook-exchange │ │ ├── TemporaryState.res │ │ ├── PageTitle.res │ │ └── Link.res │ ├── bs-css │ │ ├── Css_Js_Core.resi │ │ └── Css_Core.res │ ├── wildcards-world-ui │ │ ├── Blockie.res │ │ ├── WildcardsLoader.res │ │ ├── ThemeProvider.res │ │ ├── Animal_test.res │ │ ├── CONSTANTS.res │ │ ├── BadWords.res │ │ ├── Accounting_test.res │ │ ├── Components.res │ │ ├── Accounting.res │ │ ├── SocialButtons.res │ │ └── Validate.res │ ├── reasonml.org │ │ ├── components │ │ │ ├── ApiIntro.res │ │ │ ├── Text.res │ │ │ ├── Meta.res │ │ │ └── Tag.res │ │ └── common │ │ │ ├── BeltData.res │ │ │ ├── HighlightJs.res │ │ │ └── ColorTheme.res │ ├── warp │ │ ├── Warp_Types.res │ │ ├── Warp_Types.resi │ │ ├── Warp_Types_Method.res │ │ ├── Warp_Client.resi │ │ ├── Warp_Header.resi │ │ ├── Warp_QueryString.resi │ │ ├── Warp_FormData.resi │ │ ├── Warp_Types_ResponseType.res │ │ └── Warp.resi │ ├── reason-react-hackernews │ │ ├── index.res │ │ ├── app.res │ │ └── link.res │ ├── genType │ │ └── src │ │ │ ├── Version.res │ │ │ ├── ResolvedName.resi │ │ │ └── Emitters.resi │ ├── napkinscript │ │ └── docComments.res │ ├── mareo │ │ ├── Procedural_generator.resi │ │ └── Director.resi │ └── reason-react │ │ └── src │ │ └── ReactDOMServerRe.res └── ppx │ └── react │ ├── interfaceWithRef.resi │ ├── commentAtTop.res │ ├── expected │ ├── interfaceWithRef.resi.txt │ ├── interface.resi.txt │ └── commentAtTop.res.txt │ ├── interface.res │ ├── interface.resi │ ├── nested.res │ ├── defaultValueProp.res │ ├── interfaceWithRef.res │ ├── optimizeAutomaticMode.res │ ├── lowercases.res │ └── innerModule.res ├── .ocamlformat-ignore ├── src ├── res_driver_binary.mli ├── res_core.mli ├── dune ├── res_ast_debugger.mli ├── res_driver_reason_binary.mli ├── res_minibuffer.mli ├── res_utf8.mli ├── res_multi_printer.mli ├── res_io.mli ├── res_driver_ml_parser.mli └── res_io.ml ├── scripts └── testok.sh ├── compiler-libs-406 ├── dune └── delayed_checks.mli ├── testrunner └── dune ├── dune ├── cli └── dune ├── .gitignore └── .ocamlformat /tests/parsing/other/emptyFile.res: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ocamlformat-ignore: -------------------------------------------------------------------------------- 1 | compiler-libs-406/* 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/id.res: -------------------------------------------------------------------------------- 1 | n.R. -------------------------------------------------------------------------------- /tests/parsing/other/emptyInterface.resi: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/printer/pattern/any.res: -------------------------------------------------------------------------------- 1 | let _ = 1 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/for.res: -------------------------------------------------------------------------------- 1 | for x 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/keywordOnly.res: -------------------------------------------------------------------------------- 1 | type -------------------------------------------------------------------------------- /tests/parsing/other/expected/emptyFile.res.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/conversion/reason/refSugar.ml: -------------------------------------------------------------------------------- 1 | let x = !foo 2 | -------------------------------------------------------------------------------- /tests/parsing/other/expected/emptyInterface.resi.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/conversion/reason/ternary.res: -------------------------------------------------------------------------------- 1 | let a = x ? 1 : 2 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/variant.res: -------------------------------------------------------------------------------- 1 | type t = | @foo X 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/badCharacter.res: -------------------------------------------------------------------------------- 1 | let $ = 1 -------------------------------------------------------------------------------- /tests/parsing/other/expected/comments.res.txt: -------------------------------------------------------------------------------- 1 | let x = 1 -------------------------------------------------------------------------------- /tests/parsing/other/expected/onlyMultilineComment.res.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parsing/other/expected/onlyMultilineComment.resi.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parsing/other/expected/onlySinglelineComment.res.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parsing/recovery/string/emptyeof.res: -------------------------------------------------------------------------------- 1 | let x = " 2 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/any.res.txt: -------------------------------------------------------------------------------- 1 | let _ = 1 2 | -------------------------------------------------------------------------------- /tests/api/reiSyntax.resi: -------------------------------------------------------------------------------- 1 | // test .rei file 2 | let x: int 3 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/Icon.res: -------------------------------------------------------------------------------- 1 | include PfIcon 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/emptyeof.res: -------------------------------------------------------------------------------- 1 | let x = " 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/misc.res: -------------------------------------------------------------------------------- 1 | let x = _ + 1 2 | -------------------------------------------------------------------------------- /tests/parsing/other/expected/onlySinglinelineComment.resi.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parsing/recovery/string/eof.res: -------------------------------------------------------------------------------- 1 | let x = "eof here 2 | -------------------------------------------------------------------------------- /tests/printer/other/lor.res: -------------------------------------------------------------------------------- 1 | let lower = ch => lor(32, ch) 2 | -------------------------------------------------------------------------------- /tests/printer/pattern/extension.res: -------------------------------------------------------------------------------- 1 | let %extensionPoint = 1 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/gentype.resi: -------------------------------------------------------------------------------- 1 | @genType 2 | let x: int 3 | -------------------------------------------------------------------------------- /tests/conversion/reason/letprivate.res: -------------------------------------------------------------------------------- 1 | %%private(let x = 34) 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/refSugarReason.res: -------------------------------------------------------------------------------- 1 | let x = foo.contents 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/nativeint.res: -------------------------------------------------------------------------------- 1 | let nativeint = 3n 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/unclosedString.res: -------------------------------------------------------------------------------- 1 | let z = "eof 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/emptyRecord.res: -------------------------------------------------------------------------------- 1 | type record = {} 2 | -------------------------------------------------------------------------------- /tests/parsing/grammar/pattern/var.res: -------------------------------------------------------------------------------- 1 | let x = 1 2 | let list = 2 3 | -------------------------------------------------------------------------------- /tests/parsing/infiniteLoops/polymorphicVariantType.res: -------------------------------------------------------------------------------- 1 | type x = [ -------------------------------------------------------------------------------- /tests/parsing/other/semi.res: -------------------------------------------------------------------------------- 1 | type t = Red 2 | Red 3 | (foo) := 1 4 | -------------------------------------------------------------------------------- /tests/parsing/recovery/comments/eof.res: -------------------------------------------------------------------------------- 1 | let x = 1 2 | /* eof 3 | -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/jsx.res: -------------------------------------------------------------------------------- 1 | let x =
2 | -------------------------------------------------------------------------------- /src/res_driver_binary.mli: -------------------------------------------------------------------------------- 1 | val printEngine : Res_driver.printEngine 2 | -------------------------------------------------------------------------------- /tests/api/resiSyntax.resi: -------------------------------------------------------------------------------- 1 | // test interface file 2 | 3 | let x: int 4 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/refSugar.ml.txt: -------------------------------------------------------------------------------- 1 | let x = foo.contents 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/ternary.res.txt: -------------------------------------------------------------------------------- 1 | let a = x ? 1 : 2 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/variant.res.txt: -------------------------------------------------------------------------------- 1 | type t = | @foo X 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/patternMatching.res: -------------------------------------------------------------------------------- 1 | switch expr { 2 | } 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/exoticIdent.res: -------------------------------------------------------------------------------- 1 | let \"a 2 | b 3 | c" = 1 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/consecutive.res: -------------------------------------------------------------------------------- 1 | open Foo exception Bar 2 | -------------------------------------------------------------------------------- /tests/parsing/recovery/structure/letBinding.res: -------------------------------------------------------------------------------- 1 | let x = = doStuff(y) 2 | -------------------------------------------------------------------------------- /tests/printer/modExpr/extension.res: -------------------------------------------------------------------------------- 1 | module React = %import("react") 2 | -------------------------------------------------------------------------------- /tests/printer/structure/moduleTypeDeclaration.res: -------------------------------------------------------------------------------- 1 | module type S = X 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/gentype.resi.txt: -------------------------------------------------------------------------------- 1 | @genType 2 | let x: int 3 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/letprivate.res.txt: -------------------------------------------------------------------------------- 1 | %%private(let x = 34) 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/taggedTemplateLiterals.res: -------------------------------------------------------------------------------- 1 | foo()`null` 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/unclosedComment.res: -------------------------------------------------------------------------------- 1 | /* eof 2 | * reached 3 | -------------------------------------------------------------------------------- /tests/parsing/grammar/pattern/expected/var.res.txt: -------------------------------------------------------------------------------- 1 | let x = 1 2 | let list = 2 -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/any.res: -------------------------------------------------------------------------------- 1 | type t = _ 2 | 3 | let t: _ = x 4 | -------------------------------------------------------------------------------- /tests/parsing/other/onlySinglelineComment.res: -------------------------------------------------------------------------------- 1 | // one single-line comment 2 | -------------------------------------------------------------------------------- /tests/printer/other/expected/lor.res.txt: -------------------------------------------------------------------------------- 1 | let lower = ch => lor(32, ch) 2 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | let %extensionPoint = 1 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/refSugarReason.res.txt: -------------------------------------------------------------------------------- 1 | let x = foo.contents 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/typexpr/typeVar.res: -------------------------------------------------------------------------------- 1 | type x<'A> = '_ 2 | type x<'A> = 'let 3 | -------------------------------------------------------------------------------- /tests/parsing/other/onlySinglinelineComment.resi: -------------------------------------------------------------------------------- 1 | // one single-line comment 2 | -------------------------------------------------------------------------------- /tests/printer/comments/fileWithOneSingleLineComment.res: -------------------------------------------------------------------------------- 1 | // retain this comment 2 | -------------------------------------------------------------------------------- /tests/printer/expr/letmodule.res: -------------------------------------------------------------------------------- 1 | let x = { 2 | module M = ME 3 | Me.x 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/expected/emptyRecord.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec record = { 2 | } -------------------------------------------------------------------------------- /tests/parsing/grammar/interface/interface.resi: -------------------------------------------------------------------------------- 1 | let x: int 2 | 3 | let s: string 4 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/diamond.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec ('a, 'b) t = .. -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/any.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = _ 2 | let (t : _) = x -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/parenthesized.res: -------------------------------------------------------------------------------- 1 | type t = @attr ((~a: int) => unit) 2 | -------------------------------------------------------------------------------- /tests/parsing/infiniteLoops/templateEof.res: -------------------------------------------------------------------------------- 1 | et foo = x => 2 | switch x { 3 | | `${ -------------------------------------------------------------------------------- /tests/parsing/other/expected/singleLineCommentWithoutNewline.res.txt: -------------------------------------------------------------------------------- 1 | ;;RootView.init () -------------------------------------------------------------------------------- /tests/parsing/other/singleLineCommentWithoutNewline.res: -------------------------------------------------------------------------------- 1 | RootView.init() 2 | 3 | //int -------------------------------------------------------------------------------- /tests/parsing/recovery/string/unclosed.res: -------------------------------------------------------------------------------- 1 | let x = "unclosed" 2 | 3 | let y = 1 4 | -------------------------------------------------------------------------------- /tests/printer/comments/interfaceWithOneSingleComment.resi: -------------------------------------------------------------------------------- 1 | // retain this comment 2 | -------------------------------------------------------------------------------- /tests/printer/comments/whitespaceCase2.res: -------------------------------------------------------------------------------- 1 | let a = 2 | 2 // c2 3 | 4 | let b = 1 5 | -------------------------------------------------------------------------------- /tests/printer/modExpr/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | module React = %import("react") 2 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/moduleTypeDeclaration.res.txt: -------------------------------------------------------------------------------- 1 | module type S = X 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/emptyBlock.res: -------------------------------------------------------------------------------- 1 | let x = {} 2 | 3 | let f = (a, b) => {} 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/emptyBlock.res.txt: -------------------------------------------------------------------------------- 1 | let x = { } 2 | let f a b = { } -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/escapeSequence.res: -------------------------------------------------------------------------------- 1 | let x = "\055" 2 | 3 | let x = "\123" 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/letBindingPatternKeyword.res: -------------------------------------------------------------------------------- 1 | let open = 1 2 | let for = 3 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/namedParameters.res: -------------------------------------------------------------------------------- 1 | type draw = (stroke: pencil) => unit 2 | -------------------------------------------------------------------------------- /tests/parsing/grammar/interface/expected/interface.resi.txt: -------------------------------------------------------------------------------- 1 | val x : int 2 | val s : string -------------------------------------------------------------------------------- /tests/parsing/other/onlyMultilineComment.res: -------------------------------------------------------------------------------- 1 | /* 2 | * one comment 3 | * here 4 | */ 5 | -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/emptyBlock.res: -------------------------------------------------------------------------------- 1 | let x = {} 2 | 3 | let f = (a, b) => {} 4 | -------------------------------------------------------------------------------- /tests/parsing/recovery/string/expected/unclosed.res.txt: -------------------------------------------------------------------------------- 1 | let x = {js|unclosed|js} 2 | let y = 1 -------------------------------------------------------------------------------- /tests/printer/expr/letexception.res: -------------------------------------------------------------------------------- 1 | let x = { 2 | exception Foo 3 | sideEffect 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/errors/signature/closingBraces.resi: -------------------------------------------------------------------------------- 1 | let x: int 2 | 3 | }}} 4 | 5 | let y: int 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/closingBraces.res: -------------------------------------------------------------------------------- 1 | let x = 1 2 | 3 | }}} 4 | 5 | let y = 2 6 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/typeNonrec.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = 2 | | Water -------------------------------------------------------------------------------- /tests/parsing/other/expected/semi.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = 2 | | Red 3 | ;;Red 4 | ;;foo := 1 -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/expected/emptyBlock.res.txt: -------------------------------------------------------------------------------- 1 | let x = { } 2 | let f a b = { } -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/infinite.res: -------------------------------------------------------------------------------- 1 | let smallest = 2 | heap.compare(.) < a->f(b) 3 | -------------------------------------------------------------------------------- /tests/parsing/recovery/string/es6template.res: -------------------------------------------------------------------------------- 1 | let x = `this contains ${foo}, missing closing 2 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/whitespaceCase2.res.txt: -------------------------------------------------------------------------------- 1 | let a = 2 // c2 2 | 3 | let b = 1 4 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/letmodule.res.txt: -------------------------------------------------------------------------------- 1 | let x = { 2 | module M = ME 3 | Me.x 4 | } 5 | -------------------------------------------------------------------------------- /tests/printer/modType/extension.res: -------------------------------------------------------------------------------- 1 | module type ReactInterface = %import("react-bindings") 2 | -------------------------------------------------------------------------------- /tests/printer/other/reasonInterfaceFile.resi: -------------------------------------------------------------------------------- 1 | /* parse reason interface file */ 2 | let x: int 3 | -------------------------------------------------------------------------------- /tests/printer/signature/open.resi: -------------------------------------------------------------------------------- 1 | open Belt 2 | 3 | open! Belt 4 | 5 | @attr 6 | open Belt 7 | -------------------------------------------------------------------------------- /tests/printer/signature/typext.resi: -------------------------------------------------------------------------------- 1 | type Rgb.color += 2 | | Red 3 | | Blue 4 | | Green 5 | -------------------------------------------------------------------------------- /tests/printer/structure/open.res: -------------------------------------------------------------------------------- 1 | open Belt 2 | 3 | @attr 4 | open Belt 5 | 6 | open! Belt 7 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseAuthors__Types.res: -------------------------------------------------------------------------------- 1 | module Author = CourseAuthors__Author 2 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseEditor__Types.res: -------------------------------------------------------------------------------- 1 | module Course = CourseEditor__Course 2 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/Date.res: -------------------------------------------------------------------------------- 1 | let iso8601 = t => t |> DateFns.format("YYYY-MM-DD") 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/emptyInlineRecord.res: -------------------------------------------------------------------------------- 1 | type node<'a> = 2 | | Nil 3 | | Node({}) 4 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/constrained.res: -------------------------------------------------------------------------------- 1 | module X = (A: MyMod) 2 | 3 | include (X : MyMod) 4 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/expected/constrained.res.txt: -------------------------------------------------------------------------------- 1 | module X : MyMod = A 2 | include (X : MyMod) -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/module.res: -------------------------------------------------------------------------------- 1 | module A: Map = {let m = 2} 2 | module A = {let m = 2} 3 | -------------------------------------------------------------------------------- /tests/parsing/other/onlyMultilineComment.resi: -------------------------------------------------------------------------------- 1 | /* 2 | * multi 3 | * line 4 | * comment 5 | */ 6 | -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/array.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | [a, b => () 3 | | [a, [c, d => () 4 | } 5 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/fileWithOneSingleLineComment.res.txt: -------------------------------------------------------------------------------- 1 | // retain this comment 2 | 3 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/interfaceWithOneSingleComment.resi.txt: -------------------------------------------------------------------------------- 1 | // retain this comment 2 | 3 | -------------------------------------------------------------------------------- /tests/printer/comments/interfaceWithOnlyComments.resi: -------------------------------------------------------------------------------- 1 | // test 2 | 3 | /* test */ 4 | 5 | // ok 6 | -------------------------------------------------------------------------------- /tests/printer/signature/extension.resi: -------------------------------------------------------------------------------- 1 | %%raw("eval(js)") 2 | 3 | @attr 4 | %%extension(payload) 5 | -------------------------------------------------------------------------------- /tests/api/mliSyntax.mli: -------------------------------------------------------------------------------- 1 | (* test mli file *) 2 | 3 | val x: int 4 | 5 | (* comment *) 6 | val y: float 7 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/layouts/StudentTopNav__Types.res: -------------------------------------------------------------------------------- 1 | module NavLink = StudentTopNav__NavLink 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/expected/escapeSequence.res.txt: -------------------------------------------------------------------------------- 1 | let x = {js|\x37|js} 2 | let x = {js|\x7b|js} -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/record.res: -------------------------------------------------------------------------------- 1 | type observation = { 2 | observed: int, 3 | observer: 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/modType.res: -------------------------------------------------------------------------------- 1 | module type X = Foo 2 | 3 | @attr 4 | module type X = Foo 5 | -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/if.res: -------------------------------------------------------------------------------- 1 | if (foo == bar) Js.log("if-branch") else Js.log("else-branch") 2 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/letexception.res.txt: -------------------------------------------------------------------------------- 1 | let x = { 2 | exception Foo 3 | sideEffect 4 | } 5 | -------------------------------------------------------------------------------- /tests/printer/modType/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | module type ReactInterface = %import("react-bindings") 2 | -------------------------------------------------------------------------------- /tests/printer/pattern/alias.res: -------------------------------------------------------------------------------- 1 | let x as y = 1 2 | let (x as y) as z = 1 3 | let (Foo | Bar) as x = 1 4 | -------------------------------------------------------------------------------- /tests/printer/pattern/lazy.res: -------------------------------------------------------------------------------- 1 | let lazy x = 1 2 | let lazy (Foo | Bar) = 1 3 | let lazy (x as y) = 1 4 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/open.res.txt: -------------------------------------------------------------------------------- 1 | open Belt 2 | 3 | @attr 4 | open Belt 5 | 6 | open! Belt 7 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Types.res: -------------------------------------------------------------------------------- 1 | module Course = SchoolAdminNavbar__Course 2 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CoachesSchoolIndex__Types.res: -------------------------------------------------------------------------------- 1 | module Coach = CoachesSchoolIndex__Coach 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/stringLiteral.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | "\055" => () 3 | | "\123" => () 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/modType.res.txt: -------------------------------------------------------------------------------- 1 | module type X = Foo 2 | module type X = Foo[@@attr ] -------------------------------------------------------------------------------- /tests/parsing/recovery/typeDef/typeParams.res: -------------------------------------------------------------------------------- 1 | type node('a) = { 2 | _value: Js.Nullable.value<'a> 3 | } 4 | -------------------------------------------------------------------------------- /tests/printer/other/expected/reasonInterfaceFile.resi.txt: -------------------------------------------------------------------------------- 1 | /* parse reason interface file */ 2 | let x: int 3 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/extension.resi.txt: -------------------------------------------------------------------------------- 1 | %%raw("eval(js)") 2 | 3 | @attr 4 | %%extension(payload) 5 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/open.resi.txt: -------------------------------------------------------------------------------- 1 | open Belt 2 | 3 | open! Belt 4 | 5 | @attr 6 | open Belt 7 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/typext.resi.txt: -------------------------------------------------------------------------------- 1 | type Rgb.color += 2 | | Red 3 | | Blue 4 | | Green 5 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Performance.res: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | @send external now: t => float = "" 4 | -------------------------------------------------------------------------------- /tests/idempotency/ludum-dare-46/IndexHot.res: -------------------------------------------------------------------------------- 1 | let a = Json.parse("{}") 2 | Reprocessing.hotreload("src/index.re") 3 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/Loading.res: -------------------------------------------------------------------------------- 1 | type t = 2 | | NotLoading 3 | | Reloading 4 | | LoadingMore 5 | -------------------------------------------------------------------------------- /tests/idempotency/reasongl/ReasonglInterface.res: -------------------------------------------------------------------------------- 1 | module Gl = RGLInterface 2 | 3 | module Constants = RGLConstants 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/array.res: -------------------------------------------------------------------------------- 1 | // missing ] before ) 2 | let xs = x.map(key => [key, predicates[key]) 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/if.res: -------------------------------------------------------------------------------- 1 | // missing brace below 2 | if (match) 3 | let a = 1 4 | a + 1 5 | } 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/object.res: -------------------------------------------------------------------------------- 1 | let obj = {"\055": "octal escape", "\123": "another octal escape"} 2 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/coerce.res: -------------------------------------------------------------------------------- 1 | let foo = (x:int) => (x :> int) 2 | 3 | let foo = x => (x : t :> int) -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/let.res.txt: -------------------------------------------------------------------------------- 1 | module type Sig = sig val x : int val y : string[@@attr ] end -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/includeStatement.res: -------------------------------------------------------------------------------- 1 | include Belt.Array 2 | 3 | @onInclude include Belt.Array 4 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/diamond.res: -------------------------------------------------------------------------------- 1 | // >= shouldn't be picked up as infix op 2 | type t<'a, 'b>= .. 3 | -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/expected/infinite.res.txt: -------------------------------------------------------------------------------- 1 | let smallest = ((heap.compare ())[@bs ]) < (a |. (f b)) -------------------------------------------------------------------------------- /tests/parsing/recovery/typexpr/typeConstructorArgs.res: -------------------------------------------------------------------------------- 1 | type node<'a> = { 2 | _value: Js.Nullable.value('a) 3 | } 4 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/interfaceWithOnlyComments.resi.txt: -------------------------------------------------------------------------------- 1 | // test 2 | 3 | /* test */ 4 | 5 | // ok 6 | 7 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/alias.res.txt: -------------------------------------------------------------------------------- 1 | let x as y = 1 2 | let (x as y) as z = 1 3 | let (Foo | Bar) as x = 1 4 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/lazy.res.txt: -------------------------------------------------------------------------------- 1 | let lazy x = 1 2 | let lazy (Foo | Bar) = 1 3 | let lazy (x as y) = 1 4 | -------------------------------------------------------------------------------- /tests/api/resSyntax.res: -------------------------------------------------------------------------------- 1 | // test file 2 | 3 | if true { 4 | Js.log("true") 5 | } else { 6 | Js.log("false") 7 | } 8 | -------------------------------------------------------------------------------- /tests/conversion/reason/underscoreSugar.res: -------------------------------------------------------------------------------- 1 | let photo = pricedRoom["room"]["photos"] |> filterNone |> Array.get(_, 0) 2 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/SchoolCustomize__Types.res: -------------------------------------------------------------------------------- 1 | module Customizations = SchoolCustomize__Customizations 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/stringLiteral.res.txt: -------------------------------------------------------------------------------- 1 | ;;match x with | {js|\x37|js} -> () | {js|\x7b|js} -> () -------------------------------------------------------------------------------- /tests/parsing/errors/signature/attributes.resi: -------------------------------------------------------------------------------- 1 | module type MissingItem = { 2 | @attr 3 | } 4 | 5 | @attrWithoutItem 6 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/coerce.res.txt: -------------------------------------------------------------------------------- 1 | let foo (x : int) = (x :> int) 2 | let foo x = ((x : t) :> int) -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/expected/structure.res.txt: -------------------------------------------------------------------------------- 1 | module X = struct let a = 1 end 2 | include struct let b = 2 end -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/structure.res: -------------------------------------------------------------------------------- 1 | module X = { 2 | let a = 1 3 | } 4 | 5 | include { 6 | let b = 2 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/let.res: -------------------------------------------------------------------------------- 1 | module type Sig = { 2 | let x: int 3 | 4 | @attr 5 | let y: string 6 | } 7 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/includeStatement.res.txt: -------------------------------------------------------------------------------- 1 | include Belt.Array 2 | include Belt.Array[@@onInclude ] -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/parenthesized.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = ((a:((int)[@ns.namedArgLoc ]) -> unit)[@attr ]) -------------------------------------------------------------------------------- /tests/parsing/other/comments.res: -------------------------------------------------------------------------------- 1 | /* nested /* comments */ */ 2 | 3 | /* lvl 0 /* lvl 1 /* lvl 2 */ */ */ 4 | let x = 1 5 | -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/tuple.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | (a => () 3 | | (a, (b, c) => () 4 | | (a, (b, c => () 5 | } 6 | -------------------------------------------------------------------------------- /tests/printer/other/comments.res: -------------------------------------------------------------------------------- 1 | /* nested /* comments */ */ 2 | 3 | /* lvl 0 /* lvl 1 /* lvl 2 */ */ */ 4 | let x = 1 5 | -------------------------------------------------------------------------------- /tests/printer/typeDef/constraint.res: -------------------------------------------------------------------------------- 1 | type t = Reducer 2 | constraint 't = @attr ('state, 'action) => 'nextSubtree 3 | -------------------------------------------------------------------------------- /tests/conversion/reason/unicode.res: -------------------------------------------------------------------------------- 1 | let x = "✅ foo bar" 2 | 3 | let x = "\n okokok" 4 | 5 | let z = "\t \b \n okok 🙈" 6 | -------------------------------------------------------------------------------- /tests/idempotency/covid-19charts.com/src/CopyToClipboard.res: -------------------------------------------------------------------------------- 1 | @module external copy: string => unit = "copy-to-clipboard" 2 | -------------------------------------------------------------------------------- /tests/idempotency/nook-exchange/TemporaryState.res: -------------------------------------------------------------------------------- 1 | type t = FromProfileBrowser 2 | let state: ref> = ref(None) 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/attributes.res: -------------------------------------------------------------------------------- 1 | module MissingExpression = { 2 | @attr 3 | } 4 | 5 | @attrWithNoExpression 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/external.res: -------------------------------------------------------------------------------- 1 | // missing JS value name 2 | external setTimeout: (unit => unit, int) => float = 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/polyvariant.res: -------------------------------------------------------------------------------- 1 | type t = [< ] 2 | 3 | type z = [< | #A | #B > ] 4 | 5 | type rec t = [] 6 | 7 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/bsObject.res: -------------------------------------------------------------------------------- 1 | type foo<'a> = {.. "foo": int} as 'a 2 | type foo<'a> = {"foo": int} as 'a 3 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/typeNonrec.res: -------------------------------------------------------------------------------- 1 | // just support nonrec for fault tolerance 2 | type nonrec t = Water 3 | -------------------------------------------------------------------------------- /tests/printer/comments/whitespaceCase1.res: -------------------------------------------------------------------------------- 1 | let x = 1 2 | // comment 3 | 4 | let 123 = 123 5 | // comment2 6 | let f = () 7 | -------------------------------------------------------------------------------- /tests/printer/other/reasonFile.res: -------------------------------------------------------------------------------- 1 | /* parses reason file */ 2 | let () = { 3 | let msg = "test" 4 | msg->Js.log 5 | } 6 | -------------------------------------------------------------------------------- /tests/printer/structure/moduleBinding.res: -------------------------------------------------------------------------------- 1 | module React = { 2 | type t 3 | 4 | let render = () => Js.log("foo") 5 | } 6 | -------------------------------------------------------------------------------- /tests/printer/typeDef/expected/constraint.res.txt: -------------------------------------------------------------------------------- 1 | type t = Reducer constraint 't = @attr ('state, 'action) => 'nextSubtree 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/typexpr/garbage.res: -------------------------------------------------------------------------------- 1 | @bs.module("moduleName") 2 | external printName: (~name:?, unit) => unit = "printName" 3 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/float.res.txt: -------------------------------------------------------------------------------- 1 | ;;1. /. 2. 2 | ;;3. *. 4. 3 | ;;2. ** 2. 4 | ;;10.2 +. 5.4 5 | ;;28.9 -. 13.8 -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/module.res.txt: -------------------------------------------------------------------------------- 1 | module A : Map = struct let m = 2 end 2 | module A = struct let m = 2 end -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/record.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | {a, b: {x, y => () 3 | | {...x, y} => () 4 | | {a, _, b} => () 5 | } 6 | -------------------------------------------------------------------------------- /tests/ppx/react/interfaceWithRef.resi: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make: (~x: string, ~ref: ReactDOM.Ref.currentDomRef=?) => React.element -------------------------------------------------------------------------------- /tests/printer/comments/fileWithOnlyComments.res: -------------------------------------------------------------------------------- 1 | // test 2 | 3 | /* multi 4 | line 5 | comment 6 | */ 7 | 8 | // more comments 9 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/underscoreSugar.res.txt: -------------------------------------------------------------------------------- 1 | let photo = pricedRoom["room"]["photos"] |> filterNone |> Array.get(_, 0) 2 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/unicode.res.txt: -------------------------------------------------------------------------------- 1 | let x = "✅ foo bar" 2 | 3 | let x = "\n okokok" 4 | 5 | let z = "\t \b \n okok 🙈" 6 | -------------------------------------------------------------------------------- /tests/conversion/reason/moduleLanguage.res: -------------------------------------------------------------------------------- 1 | let someFunctorAsFunction = (x: module(MT)): module(ResT) => module(SomeFunctor(unpack(x))) 2 | -------------------------------------------------------------------------------- /tests/idempotency/bs-css/Css_Js_Core.resi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rescript-lang/syntax/HEAD/tests/idempotency/bs-css/Css_Js_Core.resi -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/packs/SchoolsCoursesIndexPack.res: -------------------------------------------------------------------------------- 1 | ReactDOMRe.renderToElementWithId(, "course-editor") 2 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/users/UsersHome__Types.res: -------------------------------------------------------------------------------- 1 | module Course = UsersHome__Course 2 | module Community = UsersHome__Community 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/hashIdent.res: -------------------------------------------------------------------------------- 1 | let x = #10s 2 | 3 | type t = [ #red | #10s ] 4 | 5 | switch x { 6 | | #10s => () 7 | } 8 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/whitespaceCase1.res.txt: -------------------------------------------------------------------------------- 1 | let x = 1 2 | // comment 3 | 4 | let 123 = 123 5 | // comment2 6 | let f = () 7 | -------------------------------------------------------------------------------- /tests/printer/other/expected/comments.res.txt: -------------------------------------------------------------------------------- 1 | /* nested /* comments */ */ 2 | 3 | /* lvl 0 /* lvl 1 /* lvl 2 */ */ */ 4 | let x = 1 5 | -------------------------------------------------------------------------------- /tests/printer/other/expected/reasonFile.res.txt: -------------------------------------------------------------------------------- 1 | /* parses reason file */ 2 | let () = { 3 | let msg = "test" 4 | msg->Js.log 5 | } 6 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/moduleBinding.res.txt: -------------------------------------------------------------------------------- 1 | module React = { 2 | type t 3 | 4 | let render = () => Js.log("foo") 5 | } 6 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/Blockie.res: -------------------------------------------------------------------------------- 1 | @module("./blockie-default.js") 2 | external makeBlockie: (. string) => string = "default" 3 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/array.res.txt: -------------------------------------------------------------------------------- 1 | let x = [|1;2;3|] 2 | let x = [|1;2;3|] 3 | let x = [|(1 : int);(2 : int);(3 : int)|] -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/tuple.res.txt: -------------------------------------------------------------------------------- 1 | let x = (1, 2, 3) 2 | let x = (1, 2, 3) 3 | let x = ((1 : int), (2 : int), (3 : int)) -------------------------------------------------------------------------------- /tests/printer/modType/moduleTypeOf.res: -------------------------------------------------------------------------------- 1 | module type LinkedList = module type of List 2 | module type LinkedList = @attr module type of List 3 | -------------------------------------------------------------------------------- /tests/printer/other/reasonString.res: -------------------------------------------------------------------------------- 1 | let x = j`foo \${bar` 2 | let x = j`foo \`bar` 3 | let x = j`foo \\bar` 4 | let x = j`foo \\\${bar` 5 | -------------------------------------------------------------------------------- /src/res_core.mli: -------------------------------------------------------------------------------- 1 | val parseImplementation : Res_parser.t -> Parsetree.structure 2 | val parseSpecification : Res_parser.t -> Parsetree.signature 3 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Base64__test.res: -------------------------------------------------------------------------------- 1 | open Webapi.Base64 2 | 3 | let _ = atob("foo") 4 | let _ = btoa("gibberish") 5 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/FaIcon.res: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make = (~classes) => 3 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/components/ApiIntro.res: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make = (~children) =>
children
3 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/object.res.txt: -------------------------------------------------------------------------------- 1 | let obj = 2 | [%obj { \x37 = {js|octal escape|js}; \x7b = {js|another octal escape|js} }] -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/try.res: -------------------------------------------------------------------------------- 1 | let parsedPayload = 2 | try (Js.Json.parseExn(response)) { 3 | | _ => Js.Json.null 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/float.res: -------------------------------------------------------------------------------- 1 | 1. /. 2. 2 | 3 | 3. *. 4. 4 | 5 | 2. ** 2. 6 | 7 | 10.2 +. 5.4 8 | 9 | 28.9 -. 13.8 10 | -------------------------------------------------------------------------------- /tests/parsing/other/gentype.res: -------------------------------------------------------------------------------- 1 | module M: { 2 | export type t = int 3 | export x: int 4 | } = { 5 | type t = int 6 | let x = 34 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/list.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | list{} => () 3 | | list{1, list{} => () 4 | | list{}...1, ...list{3, 4} => () 5 | } 6 | -------------------------------------------------------------------------------- /tests/printer/modType/ident.res: -------------------------------------------------------------------------------- 1 | module type T = Tree 2 | 3 | module type T = @attr Tree 4 | 5 | module type list = list 6 | module type t = s 7 | -------------------------------------------------------------------------------- /scripts/testok.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | successGreen='\033[0;32m' 4 | reset='\033[0m' 5 | 6 | printf "${successGreen}✅ All Tests Passed${reset}\n" 7 | -------------------------------------------------------------------------------- /src/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name syntax) 3 | (flags 4 | (-open Compilerlibs406 :standard -w +a-4-42-40-9-48-70)) 5 | (libraries compilerlibs406)) 6 | -------------------------------------------------------------------------------- /tests/api/resReactJsx.res: -------------------------------------------------------------------------------- 1 | // test React JSX file 2 | 3 | @react.component 4 | let make = (~msg) => { 5 |
{msg->React.string}
6 | } 7 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/moduleLanguage.res.txt: -------------------------------------------------------------------------------- 1 | let someFunctorAsFunction = (x: module(MT)): module(ResT) => module(SomeFunctor(unpack(x))) 2 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Base64.res: -------------------------------------------------------------------------------- 1 | @val external btoa: string => string = "" 2 | @val external atob: string => string = "" 3 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__NodeFilter.res: -------------------------------------------------------------------------------- 1 | type t = Dom.nodeFilter 2 | 3 | let make = (f): t => {acceptNode: f} 4 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/common/BeltData.res: -------------------------------------------------------------------------------- 1 | let beltCtx: webpackCtx = %raw("require.context('../pages/belt_docs', true, /^\.\/.*\.mdx$/)") 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/oldDerefOp.res: -------------------------------------------------------------------------------- 1 | let newVelocity = velocity +. a *. secondPerFrame^; 2 | let newX = x +. newVelocity *. secondPerFrame^; 3 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/infix.res: -------------------------------------------------------------------------------- 1 | a->f(b) 2 | 3 | "string1" ++ "string2" 4 | 5 | a != b 6 | a !== b 7 | 8 | a == b 9 | a === b 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/extension.res: -------------------------------------------------------------------------------- 1 | module type T = %ext 2 | module type T = %ext.with.args("argument") 3 | 4 | module type T = @attr %ext 5 | -------------------------------------------------------------------------------- /tests/parsing/infiniteLoops/jsxChildren.res: -------------------------------------------------------------------------------- 1 | type action = AddUser 2 | 3 | let a: action = AddUser("test") 4 | 5 | etype s = {x:list} 6 | -------------------------------------------------------------------------------- /tests/printer/comments/ifThenElse.res: -------------------------------------------------------------------------------- 1 | { // comment 2 | if condition() { 3 | renderBranch() 4 | } else { 5 | doSomeOtherThings() 6 | } 7 | } -------------------------------------------------------------------------------- /tests/printer/other/expected/reasonString.res.txt: -------------------------------------------------------------------------------- 1 | let x = j`foo \${bar` 2 | let x = j`foo \`bar` 3 | let x = j`foo \\bar` 4 | let x = j`foo \\\${bar` 5 | -------------------------------------------------------------------------------- /tests/printer/signature/include.resi: -------------------------------------------------------------------------------- 1 | include Belt 2 | 3 | include { 4 | let x: int 5 | let y: int 6 | 7 | let add: (int, int) => int 8 | } 9 | -------------------------------------------------------------------------------- /tests/api/mlSyntax.ml: -------------------------------------------------------------------------------- 1 | (* test ml file *) 2 | 3 | let () = print_endline "hello world" 4 | 5 | let unicode = "🙈 😅 🙌" 6 | 7 | let d = {|Sehr Schön|} 8 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/recursiveType.ml.txt: -------------------------------------------------------------------------------- 1 | type rec tree = {"label": string, "left": option, "right": option} 2 | 3 | type t = t 4 | -------------------------------------------------------------------------------- /tests/conversion/reason/recursiveType.ml: -------------------------------------------------------------------------------- 1 | type tree = 2 | < label: string ;left: tree option ;right: tree option > Js.t 3 | 4 | type nonrec t = t 5 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Performace__test.res: -------------------------------------------------------------------------------- 1 | let _ = Webapi.Dom.window |> Webapi.Dom.Window.performance |> Webapi.Performance.now 2 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/arrow.res: -------------------------------------------------------------------------------- 1 | Object.keys(providers).reduce((elements, providerId] => { 2 | let x = 1 3 | let b = 2 4 | x + b 5 | }) 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/unexpectedConstraint.res: -------------------------------------------------------------------------------- 1 | let x = { 2 | let a = 1 3 | let b = 2 4 | a + b : int 5 | } 6 | 7 | let x = "hi": string 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/bsObject.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec 'a foo = < foo: int ;.. > as 'a 2 | type nonrec 'a foo = < foo: int > as 'a -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/constrained.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | (a : int => () 3 | // note that this is not ideal: | (a: int => unit) => exprhole 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/constructor.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | Rgb(r, g, b => () 3 | | Rgb(r, g, Color(a, b => () 4 | | Rgb(r, g, list{1, 2 => () 5 | } 6 | -------------------------------------------------------------------------------- /tests/ppx/react/commentAtTop.res: -------------------------------------------------------------------------------- 1 | // test React JSX file 2 | 3 | @react.component 4 | let make = (~msg) => { 5 |
{msg->React.string}
6 | } 7 | -------------------------------------------------------------------------------- /tests/printer/expr/open.res: -------------------------------------------------------------------------------- 1 | let element = { 2 | open React 3 | element 4 | } 5 | 6 | let element = { 7 | open! React 8 | element 9 | } 10 | -------------------------------------------------------------------------------- /tests/printer/expr/sequence.res: -------------------------------------------------------------------------------- 1 | let () = { 2 | foo() 3 | bar() 4 | } 5 | 6 | 7 | let () = { 8 | (foo(): unit) 9 | (bar(): unit) 10 | } 11 | -------------------------------------------------------------------------------- /tests/printer/pattern/array.res: -------------------------------------------------------------------------------- 1 | let [a, b, c] = 1 2 | 3 | let [aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc] = 1 4 | -------------------------------------------------------------------------------- /tests/printer/signature/value.resi: -------------------------------------------------------------------------------- 1 | let x: int 2 | let add: (int, int) => int 3 | 4 | let y: float 5 | 6 | external eval: string => unit = "js_core_eval" 7 | -------------------------------------------------------------------------------- /compiler-libs-406/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name compilerlibs406) 3 | (flags -w -8-9) 4 | (modules_without_implementation parsetree asttypes outcometree annot)) 5 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_Types.res: -------------------------------------------------------------------------------- 1 | module Client = Warp_Types_Client 2 | module Method = Warp_Types_Method 3 | module ResponseType = Warp_Types_ResponseType 4 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/WildcardsLoader.res: -------------------------------------------------------------------------------- 1 | @module("./WildcardsLoader") @react.component 2 | external make: unit => React.element = "default" 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/ambiguousArrow.res: -------------------------------------------------------------------------------- 1 | let a = b:int => "hi" 2 | 3 | let x = { 4 | let a = 1 5 | let b = 2 6 | a + b : int => "test" 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/infix.res.txt: -------------------------------------------------------------------------------- 1 | ;;a |. (f b) 2 | ;;{js|string1|js} ^ {js|string2|js} 3 | ;;a <> b 4 | ;;a != b 5 | ;;a = b 6 | ;;a == b -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/unary.res: -------------------------------------------------------------------------------- 1 | let x = !true 2 | 3 | let m = -1 4 | let m = -.2.5 5 | let x = +5 6 | let x = +.5.4 7 | 8 | let sum = -a - -b 9 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/fileWithOnlyComments.res.txt: -------------------------------------------------------------------------------- 1 | // test 2 | 3 | /* multi 4 | line 5 | comment 6 | */ 7 | 8 | // more comments 9 | 10 | -------------------------------------------------------------------------------- /tests/printer/modType/expected/moduleTypeOf.res.txt: -------------------------------------------------------------------------------- 1 | module type LinkedList = module type of List 2 | module type LinkedList = @attr 3 | module type of List 4 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/include.resi.txt: -------------------------------------------------------------------------------- 1 | include Belt 2 | 3 | include { 4 | let x: int 5 | let y: int 6 | 7 | let add: (int, int) => int 8 | } 9 | -------------------------------------------------------------------------------- /tests/printer/signature/type.resi: -------------------------------------------------------------------------------- 1 | type s = string 2 | 3 | type user = {name: string, age: int} 4 | 5 | type color = 6 | | Red 7 | | Blue 8 | | Black 9 | -------------------------------------------------------------------------------- /tests/conversion/reason/extension.res: -------------------------------------------------------------------------------- 1 | // here 2 | %%raw(` eval( 3 | __gc, 4 | 1, 5 | 0 6 | ) 7 | `) 8 | 9 | let x = %raw("10") 10 | let y = %raw("20") 11 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/InactiveStudentsPanel__Types.res: -------------------------------------------------------------------------------- 1 | module Team = InactiveStudentsPanel__Team 2 | module Student = InactiveStudentsPanel__Student 3 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_Types.resi: -------------------------------------------------------------------------------- 1 | module Client = Warp_Types_Client 2 | module Method = Warp_Types_Method 3 | module ResponseType = Warp_Types_ResponseType 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/pattern/missing.res: -------------------------------------------------------------------------------- 1 | let = 2 2 | let = 4 3 | 4 | for in 0 to 10 { 5 | Js.log("for") 6 | } 7 | 8 | switch x { 9 | | => () 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/unary.res.txt: -------------------------------------------------------------------------------- 1 | let x = not true 2 | let m = (-1) 3 | let m = (-2.5) 4 | let x = 5 5 | let x = 5.4 6 | let sum = (- a) - (- b) -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/parenthesized.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | (a => () 3 | | ([a, b => () 4 | | ({a, ...b => () 5 | | (list{1, => () 6 | | ((1, 2 => () 7 | } 8 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/sequence.res.txt: -------------------------------------------------------------------------------- 1 | let () = { 2 | foo() 3 | bar() 4 | } 5 | 6 | let () = { 7 | (foo(): unit) 8 | (bar(): unit) 9 | } 10 | -------------------------------------------------------------------------------- /tests/printer/modType/expected/ident.res.txt: -------------------------------------------------------------------------------- 1 | module type T = Tree 2 | 3 | module type T = @attr 4 | Tree 5 | 6 | module type list = list 7 | module type t = s 8 | -------------------------------------------------------------------------------- /tests/printer/pattern/exception.res: -------------------------------------------------------------------------------- 1 | let exception Exit = 1 2 | let exception (Exit | Quit) = 1 3 | let exception Exit as z = 1 4 | let exception (Exit as z) = 1 5 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/array.res.txt: -------------------------------------------------------------------------------- 1 | let [a, b, c] = 1 2 | 3 | let [aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc] = 1 4 | -------------------------------------------------------------------------------- /tests/printer/pattern/var.res: -------------------------------------------------------------------------------- 1 | let foo = 1 2 | 3 | let superLongIdentifierLongSoooooooooooooLooooooooooooooooooooooooooooooooooooooong = 1 4 | 5 | let list = 3 6 | -------------------------------------------------------------------------------- /src/res_ast_debugger.mli: -------------------------------------------------------------------------------- 1 | val printEngine : Res_driver.printEngine 2 | val sexpPrintEngine : Res_driver.printEngine 3 | val commentsPrintEngine : Res_driver.printEngine 4 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesStudents__Grade.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | timelineEventId: string, 3 | evaluationCriterionId: string, 4 | grade: int, 5 | } 6 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/StudentsEditor__Coach.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | let decode: Js.Json.t => t 4 | 5 | let id: t => string 6 | 7 | let name: t => string 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/var.res: -------------------------------------------------------------------------------- 1 | type t = 'a 2 | 3 | let t: 'a = x 4 | let t: 'a. t = x 5 | let t: 'a 'b. t = x 6 | let t: 'a 'b 'c. t = x 7 | 8 | type x<'A> = 'A 9 | -------------------------------------------------------------------------------- /tests/printer/comments/openDescription.res: -------------------------------------------------------------------------------- 1 | open /* leading */ React /* trailing */; 2 | open /* leading */ React /* trailing */ 3 | open /* leading */ React // trailing 4 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/open.res.txt: -------------------------------------------------------------------------------- 1 | let element = { 2 | open React 3 | element 4 | } 5 | 6 | let element = { 7 | open! React 8 | element 9 | } 10 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/type.resi.txt: -------------------------------------------------------------------------------- 1 | type s = string 2 | 3 | type user = {name: string, age: int} 4 | 5 | type color = 6 | | Red 7 | | Blue 8 | | Black 9 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/value.resi.txt: -------------------------------------------------------------------------------- 1 | let x: int 2 | let add: (int, int) => int 3 | 4 | let y: float 5 | 6 | external eval: string => unit = "js_core_eval" 7 | -------------------------------------------------------------------------------- /src/res_driver_reason_binary.mli: -------------------------------------------------------------------------------- 1 | (* This module represents a general interface to parse marshalled reason ast *) 2 | 3 | val parsingEngine : unit Res_driver.parsingEngine 4 | -------------------------------------------------------------------------------- /tests/idempotency/covid-19charts.com/src/Location.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | primaryColor: string, 3 | secondaryColor: string, 4 | text: string, 5 | id: Data.countryId, 6 | } 7 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/InactiveStudentsPanel__Team.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | let id: t => string 4 | 5 | let name: t => string 6 | 7 | let decode: Js.Json.t => t 8 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_Types_Method.res: -------------------------------------------------------------------------------- 1 | type t = 2 | | OPTIONS 3 | | GET 4 | | HEAD 5 | | POST 6 | | PUT 7 | | DELETE 8 | | TRACE 9 | | CONNECT 10 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/ThemeProvider.res: -------------------------------------------------------------------------------- 1 | @module("./ThemeProvider") @react.component 2 | external make: (~children: React.element) => React.element = "default" 3 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/labelledParameters.res: -------------------------------------------------------------------------------- 1 | let f = (x, y=2, z) => x + y + z 2 | 3 | let g = (~?x, ~y=2, ~z) => x + y + z 4 | 5 | type f = (x: int, y: int) => int 6 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | module type T = [%ext ] 2 | module type T = [%ext.with.args {js|argument|js}] 3 | module type T = (([%ext ])[@attr ]) -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/openDescription.res: -------------------------------------------------------------------------------- 1 | open Belt 2 | open! Belt 3 | @onOpen open Belt 4 | 5 | open Belt.Array 6 | open! Belt.Array 7 | @onOpen open! Belt.Array 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/standaloneAttribute.res: -------------------------------------------------------------------------------- 1 | @@standaloneAttribute 2 | 3 | @@standaloneAttribute("with payload") 4 | 5 | @@standaloneAttribute(x => x + 1) 6 | 7 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/ifThenElse.res.txt: -------------------------------------------------------------------------------- 1 | { 2 | // comment 3 | if condition() { 4 | renderBranch() 5 | } else { 6 | doSomeOtherThings() 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/printer/modType/exoticIdent.res: -------------------------------------------------------------------------------- 1 | module type A = Foo with type Foo.\"let"<'\"type"> = \"module" 2 | 3 | module type A = Foo with type Foo.\"let"<'\"type"> := \"module" 4 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/exception.res.txt: -------------------------------------------------------------------------------- 1 | let exception Exit = 1 2 | let exception (Exit | Quit) = 1 3 | let exception Exit as z = 1 4 | let exception (Exit as z) = 1 5 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/var.res.txt: -------------------------------------------------------------------------------- 1 | let foo = 1 2 | 3 | let superLongIdentifierLongSoooooooooooooLooooooooooooooooooooooooooooooooooooooong = 1 4 | 5 | let list = 3 6 | -------------------------------------------------------------------------------- /testrunner/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name res_test) 3 | (public_name testrunner) 4 | (flags 5 | (-open Syntax -open Compilerlibs406)) 6 | (libraries syntax compilerlibs406)) 7 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | // here 2 | %%raw(` eval( 3 | __gc, 4 | 1, 5 | 0 6 | ) 7 | `) 8 | 9 | let x = %raw("10") 10 | let y = %raw("20") 11 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/Animal_test.res: -------------------------------------------------------------------------------- 1 | open Jest 2 | 3 | describe("Expect", () => { 4 | open Expect 5 | test("toBe", () => expect(true) |> toEqual(true)) 6 | }) 7 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/CONSTANTS.res: -------------------------------------------------------------------------------- 1 | let cdnBase = "https://dd2wadt5nc0o7.cloudfront.net" 2 | 3 | let nullEthAddress = "0x0000000000000000000000000000000000000000" 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/oneElementTuple.res: -------------------------------------------------------------------------------- 1 | let faultyTuple = (a, ) 2 | 3 | switch faultyTuple { 4 | | (a, ) => () 5 | | _ => () 6 | } 7 | 8 | type faultyTuple = (string, ) 9 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/typeparams.res: -------------------------------------------------------------------------------- 1 | type t<'a> 2 | type t<'a, 'b> 3 | type t<'a, 'b, 'c,> // trailing comma 4 | 5 | type t<+'a, -'b, +_, -_,> 6 | 7 | type t<_> 8 | -------------------------------------------------------------------------------- /tests/parsing/other/expected/list.res.txt: -------------------------------------------------------------------------------- 1 | let list = x 2 | let x = list + list 3 | let f = Foo.list 4 | let x = list.list 5 | let y = Ok.Bar.list 6 | ;;list a b 7 | ;;list.list <- list -------------------------------------------------------------------------------- /tests/printer/expr/arraySet.res: -------------------------------------------------------------------------------- 1 | numbers[20] = 10 2 | 3 | streetsAddressBookThisIsALongName[streets->Belt.Array.length - 1] = streetWithAVeryVeryVerrrrrrryVeeeeeeeeeryLongName 4 | -------------------------------------------------------------------------------- /tests/printer/expr/constant.res: -------------------------------------------------------------------------------- 1 | let x = 1 2 | 3 | let x = 3.14 4 | 5 | let x = "mystring" 6 | 7 | let x = @attr 1 8 | let x = @attr 3.14 9 | let x = @attr "mystring" 10 | -------------------------------------------------------------------------------- /tests/printer/pattern/interval.res: -------------------------------------------------------------------------------- 1 | let 'a' .. 'z' = x 2 | 3 | let loop = (i, s) => 4 | switch String.get(s, i) { 5 | | '0' .. '9' | '-' => loop (i+1) 6 | | _ => s 7 | } 8 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/BadWords.res: -------------------------------------------------------------------------------- 1 | type t 2 | @new @module("bad-words") external make: unit => t = "default" 3 | @send external clean: (t, string) => string = "clean" 4 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/gh16A.res: -------------------------------------------------------------------------------- 1 | module C = { 2 | module T = Fun({ 3 | foo(a + c, b + d) 4 | }) 5 | } 6 | ) 7 | Js.log("test"); // Is omitted from the compiled JS 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/openDescription.res.txt: -------------------------------------------------------------------------------- 1 | open Belt 2 | open! Belt 3 | open Belt[@@onOpen ] 4 | open Belt.Array 5 | open! Belt.Array 6 | open! Belt.Array[@@onOpen ] -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/standaloneAttribute.res.txt: -------------------------------------------------------------------------------- 1 | [@@@standaloneAttribute ] 2 | [@@@standaloneAttribute {js|with payload|js}] 3 | [@@@standaloneAttribute fun x -> x + 1] -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/tuple.res: -------------------------------------------------------------------------------- 1 | type t = (string, int) 2 | type t = (option, option) 3 | 4 | let t: (string, int) = x 5 | let t: (option, option) = x 6 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/openDescription.res.txt: -------------------------------------------------------------------------------- 1 | open /* leading */ React /* trailing */ 2 | open /* leading */ React /* trailing */ 3 | open /* leading */ React // trailing 4 | -------------------------------------------------------------------------------- /tests/printer/structure/attribute.res: -------------------------------------------------------------------------------- 1 | @@standaloneAttribute 2 | 3 | @@import("react") 4 | 5 | @@ssuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuperLoooongName("function() {return 1}") 6 | -------------------------------------------------------------------------------- /tests/printer/typeDef/open.res: -------------------------------------------------------------------------------- 1 | type t = .. 2 | type t = private .. 3 | type t<'a, 'b> = .. 4 | type t<'a, 'b> = private .. 5 | 6 | type t = .. 7 | constraint 't = ('s, 'a) => 'sub 8 | -------------------------------------------------------------------------------- /compiler-libs-406/delayed_checks.mli: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | val reset_delayed_checks : unit -> unit 5 | val add_delayed_check : (unit -> unit) -> unit 6 | val force_delayed_checks : unit -> unit 7 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseExports__Types.res: -------------------------------------------------------------------------------- 1 | module Course = CourseExports__Course 2 | module CourseExport = CourseExports__CourseExport 3 | module Tag = CourseExports__Tag 4 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_Client.resi: -------------------------------------------------------------------------------- 1 | let make: ( 2 | ~url: string, 3 | ~method: Warp_Types_Method.t, 4 | ) => Warp_Types_Client.t>> 5 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/setField.res: -------------------------------------------------------------------------------- 1 | if (match) { 2 | let a = 1 3 | // notice missing expression after = 4 | m.left.compatibleTypeArgs = 5 | } else { 6 | sideEffect() 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/var.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = 'a 2 | let (t : 'a) = x 3 | let t : 'a . t = x 4 | let t : 'a 'b . t = x 5 | let t : 'a 'b 'c . t = x 6 | type nonrec 'A x = 'A -------------------------------------------------------------------------------- /tests/ppx/react/expected/interfaceWithRef.resi.txt: -------------------------------------------------------------------------------- 1 | type props<'x, 'ref> = {x: 'x, ref?: 'ref} 2 | let make: React.componentLike, React.element> 3 | -------------------------------------------------------------------------------- /tests/printer/comments/structure2.res: -------------------------------------------------------------------------------- 1 | let b = 2 2 | /* test */ // sldkfj 3 | 4 | // sldkfj 5 | 6 | /* help */ /* help2 */ 7 | 8 | /* test2 */ 9 | open /* before lident */ React 10 | -------------------------------------------------------------------------------- /tests/printer/modType/expected/exoticIdent.res.txt: -------------------------------------------------------------------------------- 1 | module type A = Foo with type Foo.\"let"<'\"type"> = \"module" 2 | 3 | module type A = Foo with type Foo.\"let"<'\"type"> := \"module" 4 | -------------------------------------------------------------------------------- /tests/printer/typeDef/expected/open.res.txt: -------------------------------------------------------------------------------- 1 | type t = .. 2 | type t = private .. 3 | type t<'a, 'b> = .. 4 | type t<'a, 'b> = private .. 5 | 6 | type t = .. constraint 't = ('s, 'a) => 'sub 7 | -------------------------------------------------------------------------------- /tests/printer/typexpr/alias.res: -------------------------------------------------------------------------------- 1 | type t = string as 'x 2 | type t = ((string, float) => unit) as 'x 3 | type t = (string, float) => unit as 'x 4 | type t = (string, float) => (unit as 'x) 5 | -------------------------------------------------------------------------------- /tests/api/reasonSyntax.res: -------------------------------------------------------------------------------- 1 | // test .re file 2 | let \"+++" = (a, b) => a + b 3 | 4 | let unicode = "🙈 😅 🙌" 5 | 6 | let d = `Sehr Schön` /* test */ 7 | 8 | let () = print_endline("foo") 9 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Url__test.res: -------------------------------------------------------------------------------- 1 | open Webapi.Url 2 | 3 | let params = URLSearchParams.make("key1=value1&key2=value2") 4 | URLSearchParams.forEach(Js.log2, params) 5 | -------------------------------------------------------------------------------- /tests/idempotency/reason-react-hackernews/index.res: -------------------------------------------------------------------------------- 1 | open Utils 2 | 3 | registerServiceWorker() 4 | 5 | ReactDOMRe.renderToElementWithId(, "root") 6 | 7 | ReasonReact.Router.push("") 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/array.res: -------------------------------------------------------------------------------- 1 | let x = [1, 2, 3] 2 | 3 | // trailing comma 4 | let x = [1, 2, 3,] 5 | 6 | // with constrained expressions 7 | let x = [1 :int, (2: int), 3 : int] 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/tupleVsDivision.res.txt: -------------------------------------------------------------------------------- 1 | ;;(foo ()) / 1 2 | ;;foo () 3 | ;;(1, 2) |. printTuple 4 | let f () = (((foo ()) / 1; foo (); (1, 2) |. printTuple)[@ns.braces ]) -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/tuple.res: -------------------------------------------------------------------------------- 1 | let x = (1, 2, 3) 2 | 3 | // trailing comma 4 | let x = (1, 2, 3,) 5 | 6 | // with constrained expression 7 | let x = (1 : int, (2: int), 3 : int) 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/typeparams.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec 'a t 2 | type nonrec ('a, 'b) t 3 | type nonrec ('a, 'b, 'c) t 4 | type nonrec (+'a, -'b, +_, -_) t 5 | type nonrec _ t -------------------------------------------------------------------------------- /tests/printer/expr/expected/constant.res.txt: -------------------------------------------------------------------------------- 1 | let x = 1 2 | 3 | let x = 3.14 4 | 5 | let x = "mystring" 6 | 7 | let x = @attr 1 8 | let x = @attr 3.14 9 | let x = @attr "mystring" 10 | -------------------------------------------------------------------------------- /tests/printer/expr/pipe.res: -------------------------------------------------------------------------------- 1 | let s1 = @ann (x->foo) 2 | let s1b = @ann x->foo 3 | 4 | let s2 = @ann (x|>foo) 5 | let s2b = @ann x|>foo 6 | 7 | let s3 = @ann (x**foo) 8 | let s3b = @ann x**foo 9 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/interval.res.txt: -------------------------------------------------------------------------------- 1 | let 'a' .. 'z' = x 2 | 3 | let loop = (i, s) => 4 | switch String.get(s, i) { 5 | | '0' .. '9' | '-' => loop(i + 1) 6 | | _ => s 7 | } 8 | -------------------------------------------------------------------------------- /tests/printer/signature/attributes.resi: -------------------------------------------------------------------------------- 1 | @@attr 2 | @@standaloneAttribute 3 | 4 | @@standaloneAttribute(paylod => f(payload)) 5 | 6 | @@standalone(debugger) 7 | 8 | @@standalone("eval_raw__") 9 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/attribute.res.txt: -------------------------------------------------------------------------------- 1 | @@standaloneAttribute 2 | 3 | @@import("react") 4 | 5 | @@ssuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuperLoooongName("function() {return 1}") 6 | -------------------------------------------------------------------------------- /src/res_minibuffer.mli: -------------------------------------------------------------------------------- 1 | type t 2 | val add_char : t -> char -> unit 3 | val add_string : t -> string -> unit 4 | val contents : t -> string 5 | val create : int -> t 6 | val flush_newline : t -> unit 7 | -------------------------------------------------------------------------------- /tests/conversion/reason/docComments.res: -------------------------------------------------------------------------------- 1 | @ocaml.doc(" foo ") 2 | let x = 1 3 | 4 | @ocaml.doc("") 5 | let x = 1 6 | 7 | /* ** foo */ 8 | let x = 1 9 | 10 | /* **** foo */ 11 | let x = 1 12 | -------------------------------------------------------------------------------- /tests/conversion/reason/object.ml: -------------------------------------------------------------------------------- 1 | type hi = < z : int > 2 | type 'a u = < hi ; x : int ; y : int; .. > as 'a 3 | type 'a u1 = < hi; .. > as 'a 4 | type 'a u2 = < hi ; hi; y : int ; hi; .. > as 'a 5 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseCoaches__Types.res: -------------------------------------------------------------------------------- 1 | module CourseCoach = CourseCoaches__CourseCoach 2 | module SchoolCoach = CourseCoaches__SchoolCoach 3 | module Team = CourseCoaches__Team 4 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/GraphqlQuery.resi: -------------------------------------------------------------------------------- 1 | let sendQuery: ( 2 | ~notify: bool=?, 3 | {.."parse": Js.Json.t => 'a, "query": string, "variables": Js.Json.t}, 4 | ) => Js.Promise.t<'a> 5 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/Accounting_test.res: -------------------------------------------------------------------------------- 1 | open Jest 2 | 3 | describe("Expect", () => { 4 | open Expect 5 | test("toBe", () => expect(Accounting.dummyTimes2(5)) |> toBe(10)) 6 | }) 7 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/typeConstraint.res: -------------------------------------------------------------------------------- 1 | type t = x constraint 'x = int 2 | type t = x constraint 'x = string constraint 'y = unit 3 | 4 | type t = x constraint 'a = @attr typExpr 5 | -------------------------------------------------------------------------------- /tests/ppx/react/interface.res: -------------------------------------------------------------------------------- 1 | module A = { 2 | @react.component 3 | let make = (~x) => React.string(x) 4 | } 5 | 6 | module NoProps = { 7 | @react.component 8 | let make = () =>
9 | } -------------------------------------------------------------------------------- /tests/idempotency/genType/src/Version.res: -------------------------------------------------------------------------------- 1 | /* CREATED BY genType/scripts/bump_version_module.js */ 2 | /* DO NOT MODIFY BY HAND, WILL BE AUTOMATICALLY UPDATED BY npm version */ 3 | let version = "3.18.0" 4 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/constructor.res.txt: -------------------------------------------------------------------------------- 1 | let x = Red 2 | let y = Colors.Blue 3 | let z = Rgb () 4 | let v = Vertex (1., 2., 3., 4.) 5 | let colour = Shades.Colors.White 6 | let u = () -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/tupleVsDivision.res: -------------------------------------------------------------------------------- 1 | foo() / 1 2 | 3 | foo() 4 | (1, 2)->printTuple 5 | 6 | let f = () => { 7 | foo() / 1 8 | 9 | foo() 10 | (1, 2)->printTuple 11 | } 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/typedef.res: -------------------------------------------------------------------------------- 1 | type t 2 | type t and s 3 | 4 | type t<'a> 5 | type t<'a> and s<'a> 6 | type t<'a, 'b> and s<'a, 'b> 7 | 8 | type t<'a> = node<'a> and s<'b> = edge<'b> 9 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/poly.res: -------------------------------------------------------------------------------- 1 | external getLogger: 2 | unit => { 3 | "log": 'a => unit, 4 | "log2": 'a. int => int, 5 | "log3": 'a 'b. ('a, 'b) => int 6 | } = 7 | "./src/logger.mock.js" 8 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/structure2.res.txt: -------------------------------------------------------------------------------- 1 | let b = 2 2 | /* test */ // sldkfj 3 | 4 | // sldkfj 5 | 6 | /* help */ /* help2 */ 7 | 8 | /* test2 */ 9 | open /* before lident */ React 10 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/arraySet.res.txt: -------------------------------------------------------------------------------- 1 | numbers[20] = 10 2 | 3 | streetsAddressBookThisIsALongName[ 4 | streets->Belt.Array.length - 1 5 | ] = streetWithAVeryVeryVerrrrrrryVeeeeeeeeeryLongName 6 | -------------------------------------------------------------------------------- /tests/printer/pattern/tuple.res: -------------------------------------------------------------------------------- 1 | // let (a,) = 1 -> one-element tuples are not supported 2 | let (a, b) = 1 3 | let (aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc) = 1 4 | -------------------------------------------------------------------------------- /tests/printer/typexpr/expected/alias.res.txt: -------------------------------------------------------------------------------- 1 | type t = string as 'x 2 | type t = ((string, float) => unit) as 'x 3 | type t = ((string, float) => unit) as 'x 4 | type t = (string, float) => (unit as 'x) 5 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/testHelpers.res: -------------------------------------------------------------------------------- 1 | let unsafelyUnwrapOption = x => 2 | switch x { 3 | | Some(v) => v 4 | | None => raise(Invalid_argument("Passed `None` to unsafelyUnwrapOption")) 5 | } 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/pattern/templateLiteral.res: -------------------------------------------------------------------------------- 1 | let zeroCoord = "0.0" 2 | 3 | switch l { 4 | | `zero coord ${zeroCoord}` => () 5 | | `first coord ${zeroCoord} snd ${zeroCoord} ` => () 6 | | _ => () 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/tuple.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = (string * int) 2 | type nonrec t = (int option * string option) 3 | let (t : (string * int)) = x 4 | let (t : (int option * string option)) = x -------------------------------------------------------------------------------- /tests/ppx/react/interface.resi: -------------------------------------------------------------------------------- 1 | module A: { 2 | @react.component 3 | let make: (~x: string) => React.element 4 | } 5 | 6 | module NoProps: { 7 | @react.component 8 | let make: unit => React.element 9 | } -------------------------------------------------------------------------------- /tests/printer/signature/expected/attributes.resi.txt: -------------------------------------------------------------------------------- 1 | @@attr 2 | @@standaloneAttribute 3 | 4 | @@standaloneAttribute(paylod => f(payload)) 5 | 6 | @@standalone(debugger) 7 | 8 | @@standalone("eval_raw__") 9 | -------------------------------------------------------------------------------- /dune: -------------------------------------------------------------------------------- 1 | (dirs compiler-libs-406 src cli benchmarks testrunner) 2 | 3 | (env 4 | (dev 5 | (flags 6 | (:standard -w +a-4-42-40-9-48))) 7 | (release 8 | (flags 9 | (:standard -w +a-4-42-40-9-48)))) 10 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/docComments.res.txt: -------------------------------------------------------------------------------- 1 | @ocaml.doc(" foo ") 2 | let x = 1 3 | 4 | @ocaml.doc("") 5 | let x = 1 6 | 7 | /* ** foo */ 8 | let x = 1 9 | 10 | /* **** foo */ 11 | let x = 1 12 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__Text__test.res: -------------------------------------------------------------------------------- 1 | open Webapi.Dom 2 | 3 | let node = document |> Document.createTextNode("text") |> Text.asNode 4 | 5 | let text = Text.ofNode(node) 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/implementation.res: -------------------------------------------------------------------------------- 1 | module InstallerDownload = { 2 | @react.component 3 | let make = () => { 4 |
5 | } 6 | } 7 | } 8 | module LicenseList = { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/standAloneAttribute.res: -------------------------------------------------------------------------------- 1 | module type StandaloneAttribute = { 2 | @@standaloneAttribute 3 | 4 | @@standaloneAttribute(withPayload) 5 | 6 | @@standaloneAttribute(x => x) 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/other/list.res: -------------------------------------------------------------------------------- 1 | let list = x 2 | 3 | let x = list + list 4 | 5 | let f = Foo.list 6 | 7 | let x = list.list 8 | 9 | let y = Ok.Bar.list 10 | 11 | list(a, b) 12 | 13 | list.list = list 14 | -------------------------------------------------------------------------------- /tests/printer/expr/for.res: -------------------------------------------------------------------------------- 1 | let () = for i in 0 to 10 { 2 | () 3 | } 4 | 5 | for i in 0 to 10 { 6 | let a = 1 7 | let b = 2 8 | sideEffect() 9 | } 10 | 11 | let x = @attr for i in 0 to 10 { () } 12 | -------------------------------------------------------------------------------- /tests/printer/expr/ident.res: -------------------------------------------------------------------------------- 1 | let x = a 2 | 3 | let c = Configuration.config 4 | 5 | let x = @attr identifier 6 | 7 | let x = @attributeVeryLong @attributeVeryLong @attributeVeryLong @attributeVeryLong identifier 8 | -------------------------------------------------------------------------------- /tests/printer/signature/exception.resi: -------------------------------------------------------------------------------- 1 | exception Exit 2 | 3 | @onConstructor 4 | exception ExitEarly 5 | 6 | exception Exit = Terminate 7 | exception Exit = Lib.Terminate 8 | exception Exit = Ns.Lib.Terminate 9 | -------------------------------------------------------------------------------- /src/res_utf8.mli: -------------------------------------------------------------------------------- 1 | val repl : int 2 | 3 | val max : int 4 | 5 | val decodeCodePoint : int -> string -> int -> int * int 6 | 7 | val encodeCodePoint : int -> string 8 | 9 | val isValidCodePoint : int -> bool 10 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/object.ml.txt: -------------------------------------------------------------------------------- 1 | type hi = {"z": int} 2 | type u<'a> = {.. ...hi, "x": int, "y": int} as 'a 3 | type u1<'a> = {.. ...hi} as 'a 4 | type u2<'a> = {.. ...hi, ...hi, "y": int, ...hi} as 'a 5 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__ChildNode.res: -------------------------------------------------------------------------------- 1 | /* Mixin */ 2 | module Impl = ( 3 | T: { 4 | type t 5 | }, 6 | ) => { 7 | @bs.send.pipe(: T.t) external remove: unit = "" 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesStudents__Course.res: -------------------------------------------------------------------------------- 1 | type t = {id: string} 2 | 3 | let id = t => t.id 4 | 5 | let decode = json => { 6 | open Json.Decode 7 | {id: json |> field("id", string)} 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CurriculumEditor__Course.res: -------------------------------------------------------------------------------- 1 | type t = {id: string} 2 | 3 | let id = t => t.id 4 | 5 | let decode = json => { 6 | open Json.Decode 7 | {id: json |> field("id", string)} 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/SchoolCommunities__IndexTypes.res: -------------------------------------------------------------------------------- 1 | module Course = SchoolCommunities__Course 2 | module Community = SchoolCommunities__Community 3 | module Connection = SchoolCommunities__Connection 4 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/components/Text.res: -------------------------------------------------------------------------------- 1 | module Link = { 2 | let inline = "no-underline border-b border-night-dark hover:border-bs-purple text-inherit" 3 | let standalone = "no-underline text-fire" 4 | } 5 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/jsx.res: -------------------------------------------------------------------------------- 1 | let x = 2 | let x = ; 3 | let x = ; 4 | let x = 5 | let x = 6 | let x = 7 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/while.res.txt: -------------------------------------------------------------------------------- 1 | ;;while not eofReached do 2 | let a = 1 in let b = 2 in Lexbuf.next (); (a + b) |. Js.log done 3 | ;;while (not (isLineEnding buf)) && true do foo (); next () done -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/extension.res: -------------------------------------------------------------------------------- 1 | type t = %typ 2 | 3 | type t = %raw.typ 4 | 5 | type t = %raw.typ("existential") 6 | 7 | let t: %typ = x 8 | let t: %raw.typ = x 9 | let t: %raw.typ("ex") = x 10 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/pipe.res.txt: -------------------------------------------------------------------------------- 1 | let s1 = @ann (x->foo) 2 | let s1b = (@ann x)->foo 3 | 4 | let s2 = @ann (x |> foo) 5 | let s2b = (@ann x) |> foo 6 | 7 | let s3 = @ann (x ** foo) 8 | let s3b = (@ann x) ** foo 9 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/tuple.res.txt: -------------------------------------------------------------------------------- 1 | // let (a,) = 1 -> one-element tuples are not supported 2 | let (a, b) = 1 3 | let (aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc) = 1 4 | -------------------------------------------------------------------------------- /tests/printer/signature/expected/exception.resi.txt: -------------------------------------------------------------------------------- 1 | exception Exit 2 | 3 | @onConstructor exception ExitEarly 4 | 5 | exception Exit = Terminate 6 | exception Exit = Lib.Terminate 7 | exception Exit = Ns.Lib.Terminate 8 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__DocumentOrShadowRoot.res: -------------------------------------------------------------------------------- 1 | /* Mixin */ 2 | module Impl = ( 3 | T: { 4 | type t 5 | }, 6 | ) => { 7 | /* TODO: Implemented in Shadow DOM spec */ 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__ResizeObserver/Webapi__ResizeObserver__ResizeObserverEntry.res: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | @get external contentRect: t => Dom.domRect = "" 4 | @get external target: t => Dom.element = "" 5 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/id.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/id.res:1:5 4 | 5 | 1 │ n.R. 6 | 7 | I'm not sure what to parse here when looking at "eof". 8 | 9 | ;;n.R._ -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/typeDefinition.res: -------------------------------------------------------------------------------- 1 | type t = string 2 | 3 | @onStructureItem 4 | type t = string 5 | 6 | module X = { 7 | type t = string 8 | 9 | @onStructureItem 10 | type t = string 11 | } 12 | -------------------------------------------------------------------------------- /tests/printer/structure/type.res: -------------------------------------------------------------------------------- 1 | type t = string and s = int and z = float 2 | 3 | type t = string 4 | and s = int 5 | and z = float 6 | 7 | 8 | type t = string 9 | 10 | and s = int 11 | 12 | and z = float 13 | -------------------------------------------------------------------------------- /cli/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name res_cli) 3 | (public_name rescript) 4 | (modes byte exe) 5 | (flags 6 | (-open Syntax -open Compilerlibs406) 7 | (:standard -w +a-4-42-40-9-48-70)) 8 | (libraries syntax compilerlibs406)) 9 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/extension.res: -------------------------------------------------------------------------------- 1 | %expr 2 | 3 | %expr.extension 4 | 5 | %expr.extension.with.args("argument") 6 | 7 | %expr.extension.with.args(x => f(x)) 8 | 9 | let x = %bs.raw("1") + %bs.raw("2") 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/typeConstraint.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = x constraint 'x = int 2 | type nonrec t = x constraint 'x = string constraint 'y = unit 3 | type nonrec t = x constraint 'a = ((typExpr)[@attr ]) -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/polyvariant.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | #Rgb(r, g, b => () 3 | | #Rgb(r, g, Color(a, b => () 4 | | #Rgb(r, g, list{1, 2 => () 5 | } 6 | 7 | switch x { 8 | | #a(()) => () 9 | | #a() => () 10 | } 11 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/ident.res.txt: -------------------------------------------------------------------------------- 1 | let x = a 2 | 3 | let c = Configuration.config 4 | 5 | let x = @attr identifier 6 | 7 | let x = @attributeVeryLong @attributeVeryLong @attributeVeryLong @attributeVeryLong identifier 8 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/type.res.txt: -------------------------------------------------------------------------------- 1 | type t = string and s = int and z = float 2 | 3 | type t = string 4 | and s = int 5 | and z = float 6 | 7 | type t = string 8 | 9 | and s = int 10 | 11 | and z = float 12 | -------------------------------------------------------------------------------- /tests/idempotency/covid-19charts.com/src/ColorStack.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | let make: (~locations: array) => t 4 | let updateColors: (~locations: array, t) => t 5 | let getColor: (~location: string, t) => (string, string) 6 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/while.res: -------------------------------------------------------------------------------- 1 | while !eofReached { 2 | let a = 1 3 | let b = 2 4 | Lexbuf.next(); 5 | (a + b)->Js.log 6 | } 7 | 8 | while (!isLineEnding(buf) && true) { 9 | foo() 10 | next() 11 | } 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/typLvlModAlias.res: -------------------------------------------------------------------------------- 1 | module type Signature = { 2 | module Tree = Btree 3 | module Tree = Ns.Btree 4 | 5 | @attr 6 | module Tree = Btree 7 | @attr 8 | module Tree = Ns.Btree 9 | } 10 | -------------------------------------------------------------------------------- /tests/ppx/react/nested.res: -------------------------------------------------------------------------------- 1 | module Outer = { 2 | @react.component 3 | let make = () => { 4 | module Inner = { 5 | @react.component 6 | let make = () =>
7 | } 8 | 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__NodeList__test.res: -------------------------------------------------------------------------------- 1 | open Webapi.Dom 2 | open NodeList 3 | 4 | let items = document |> Document.querySelectorAll(".item") 5 | 6 | forEach((item, _) => Js.log(item), items) 7 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/expected/keywordOnly.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/typeDef/keywordOnly.res:1:5 4 | 5 | 1 │ type 6 | 7 | I'm not sure what to parse here when looking at "eof". 8 | 9 | type nonrec _ -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/typLvlModAlias.res.txt: -------------------------------------------------------------------------------- 1 | module type Signature = 2 | sig 3 | module Tree = Btree 4 | module Tree = Ns.Btree 5 | module Tree = Btree[@@attr ] 6 | module Tree = Ns.Btree[@@attr ] 7 | end -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/itemExtension.res.txt: -------------------------------------------------------------------------------- 1 | [%%itemExtension ] 2 | [%%item.extension ] 3 | [%%item.extension.with.args {js|argument|js}] 4 | [%%item.extension.with.args fun x -> f x] 5 | [%%itemExtension ][@@attrOnExtension ] -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/typeDefinition.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = string 2 | type nonrec t = string[@@onStructureItem ] 3 | module X = 4 | struct type nonrec t = string 5 | type nonrec t = string[@@onStructureItem ] end -------------------------------------------------------------------------------- /tests/printer/expr/constraint.res: -------------------------------------------------------------------------------- 1 | let x = (Numbers.ten: int) 2 | 3 | let x = @attr (10: int) 4 | let x = (@attr 10: int) 5 | 6 | let x = (street["number"]: int) 7 | let x = (streets[0]: int) 8 | 9 | let x = (true ? 1 : 0: int) 10 | -------------------------------------------------------------------------------- /src/res_multi_printer.mli: -------------------------------------------------------------------------------- 1 | (* Interface to print source code from different languages to res. 2 | * Takes a filename called "input" and returns the corresponding formatted res syntax *) 3 | val print : [`ml | `res] -> input:string -> string 4 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/InactiveStudentsPanel__Student.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | let id: t => string 4 | 5 | let name: t => string 6 | let avatarUrl: t => string 7 | let teamId: t => string 8 | 9 | let decode: Js.Json.t => t 10 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/letBinding.res: -------------------------------------------------------------------------------- 1 | let foo = '2. 2 | 3 | let foo = }true 4 | 5 | let foo = )2 6 | 7 | let foo = }f() 8 | 9 | let foo = }}{2} 10 | 11 | let foo = == { 12 | "foo" 13 | } 14 | 15 | let foo as 'x = () 16 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/for.res.txt: -------------------------------------------------------------------------------- 1 | ;;for p = 0 to 10 do () done 2 | ;;for p = 10 downto 0 do () done 3 | ;;for p = a to b do () done 4 | ;;for p = a to b do let a = 1 in let b = 2 in a + b done 5 | ;;for p = 0 to x + 1 do () done -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/standAloneAttribute.res.txt: -------------------------------------------------------------------------------- 1 | module type StandaloneAttribute = 2 | sig 3 | [@@@standaloneAttribute ] 4 | [@@@standaloneAttribute withPayload] 5 | [@@@standaloneAttribute fun x -> x] 6 | end -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/itemExtension.res: -------------------------------------------------------------------------------- 1 | %%itemExtension 2 | 3 | %%item.extension 4 | 5 | %%item.extension.with.args("argument") 6 | 7 | %%item.extension.with.args(x => f(x)) 8 | 9 | @attrOnExtension 10 | %%itemExtension 11 | -------------------------------------------------------------------------------- /tests/ppx/react/defaultValueProp.res: -------------------------------------------------------------------------------- 1 | module C0 = { 2 | @react.component 3 | let make = (~a=2, ~b=a*2) => React.int(a + b) 4 | } 5 | 6 | module C1 = { 7 | @react.component 8 | let make = (~a=2, ~b) => React.int(a + b) 9 | } 10 | -------------------------------------------------------------------------------- /tests/printer/pattern/exoticIdent.res: -------------------------------------------------------------------------------- 1 | let \"type" = x 2 | 3 | let {\"type", \"module"} = x 4 | let {\"type": \"let", \"module": \"DangerousPattern"} = x 5 | let {Foo.\"type": \"let", \"module": \"DangerousPattern"} = x 6 | 7 | let \"1" = x 8 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseExports__Course.res: -------------------------------------------------------------------------------- 1 | type id = string 2 | 3 | type t = {id: id} 4 | 5 | let id = t => t.id 6 | 7 | let decode = json => { 8 | open Json.Decode 9 | {id: json |> field("id", string)} 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/errors/typexpr/objectSpread.res: -------------------------------------------------------------------------------- 1 | type u = {...a, u: int} 2 | 3 | type u = private {...a, u: int} 4 | 5 | type x = Type({...a, u: int}) 6 | 7 | type u = {...a, "u": int, v: int} 8 | 9 | let f = (x: {a: int, b: int}) => () 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | ;;[%expr ] 2 | ;;[%expr.extension ] 3 | ;;[%expr.extension.with.args {js|argument|js}] 4 | ;;[%expr.extension.with.args fun x -> f x] 5 | let x = ([%bs.raw {js|1|js}]) + ([%bs.raw {js|2|js}]) -------------------------------------------------------------------------------- /tests/parsing/infiniteLoops/expected/polymorphicVariantType.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/infiniteLoops/polymorphicVariantType.res:1:14 4 | 5 | 1 │ type x = [ 6 | 7 | Did you forget a `]` here? 8 | 9 | type nonrec x = [< y] -------------------------------------------------------------------------------- /tests/parsing/other/expected/attributes.res.txt: -------------------------------------------------------------------------------- 1 | let x = 1[@@attr :int] 2 | let x = 1[@@attr ?var] 3 | let x = 1[@@attr ?var when x == 1] 4 | ;;[%ext :val x : int] 5 | ;;[%ext :val x : int 6 | val y : float] 7 | [%%ext ;;{js|A|js} 8 | ;;{js|B|js}] -------------------------------------------------------------------------------- /tests/printer/typexpr/extension.res: -------------------------------------------------------------------------------- 1 | type t = %extension 2 | type t = @attr %extension 3 | 4 | external foo: %extension = "primitive" 5 | external foo: @attr %extension = "primitive" 6 | 7 | let x: %extension = z 8 | let x: @attr %extension = z 9 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__Slotable.res: -------------------------------------------------------------------------------- 1 | /* Mixin */ 2 | module Impl = ( 3 | T: { 4 | type t 5 | }, 6 | ) => { 7 | @get @return(nullable) external assignedSlot: T.t => option = "" 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesStudents__Submissions.res: -------------------------------------------------------------------------------- 1 | type rec t = 2 | | Unloaded 3 | | PartiallyLoaded(array, cursor) 4 | | FullyLoaded(array) 5 | and cursor = string 6 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/common/HighlightJs.res: -------------------------------------------------------------------------------- 1 | @deriving(abstract) 2 | type highlightResult = {value: string} 3 | 4 | @module("highlight.js/lib/highlight") 5 | external highlight: (~lang: string, ~value: string) => highlightResult = "highlight" 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/misc.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/misc.res:1:9 4 | 5 | 1 │ let x = _ + 1 6 | 2 │ 7 | 8 | `_` isn't a valid name. 9 | 10 | let x = ([%rescript.exprhole ]) + 1 -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/constructor.res: -------------------------------------------------------------------------------- 1 | let x = Red 2 | 3 | let y = Colors.Blue 4 | 5 | // sugar for Rgb(()) 6 | let z = Rgb() 7 | 8 | let v = Vertex(1., 2., 3., 4.) 9 | 10 | let colour = Shades.Colors.White 11 | 12 | let u = () 13 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/ident.res.txt: -------------------------------------------------------------------------------- 1 | let x = foo 2 | let y = Foo.Bar.x 3 | let x = _identWithUnderscore 4 | let x = _ident_ident 5 | let x = _ident_ident_ 6 | let x = __ident__ 7 | let x = list 8 | let x = Foo.Bar.list 9 | let with = with -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/itemExtension.res: -------------------------------------------------------------------------------- 1 | module type Ext = { 2 | %%item.extension 3 | 4 | %%item.extension.with.args("argument") 5 | 6 | %%item.extension.with.args(x => f(x)) 7 | 8 | @withAttr 9 | %%item.extension 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/modExprExtension.res.txt: -------------------------------------------------------------------------------- 1 | module A = [%modExprExtension ] 2 | module B = [%mod.expr.extension ] 3 | module C = [%mod.expr.extension.with.args {js|argument|js}] 4 | module D = [%mod.expr.extension.with.args fun x -> f x] -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = [%typ ] 2 | type nonrec t = [%raw.typ ] 3 | type nonrec t = [%raw.typ {js|existential|js}] 4 | let (t : [%typ ]) = x 5 | let (t : [%raw.typ ]) = x 6 | let (t : [%raw.typ {js|ex|js}]) = x -------------------------------------------------------------------------------- /tests/printer/comments/valueBindingSugar.res: -------------------------------------------------------------------------------- 1 | let /* before */ x /* after */: 2 | type t. (/* a */ int /* b */, /* c */ int /* d */) => /* e */ int /* f */ = 3 | (/* c0 */ a /* c1 */, /* c2 */ b /* c3 */) => { 4 | // comment 5 | a + b 6 | } 7 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/constraint.res.txt: -------------------------------------------------------------------------------- 1 | let x = (Numbers.ten: int) 2 | 3 | let x = (@attr 10: int) 4 | let x = (@attr 10: int) 5 | 6 | let x = (street["number"]: int) 7 | let x = (streets[0]: int) 8 | 9 | let x = (true ? 1 : 0: int) 10 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/exoticIdent.res.txt: -------------------------------------------------------------------------------- 1 | let \"type" = x 2 | 3 | let {\"type", \"module"} = x 4 | let {\"type": \"let", \"module": \"DangerousPattern"} = x 5 | let {Foo.\"type": \"let", \"module": \"DangerousPattern"} = x 6 | 7 | let \"1" = x 8 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/common/ColorTheme.res: -------------------------------------------------------------------------------- 1 | // Equivalent to styles/_theme.css 2 | 3 | @deriving(jsConverter) 4 | type t = [ 5 | | @as("theme-reason") #Reason 6 | | @as("theme-js") #Js 7 | ] 8 | 9 | let toCN = value => tToJs(value) 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/typeDefinition.res: -------------------------------------------------------------------------------- 1 | module type Signature = { 2 | type t 3 | 4 | type t<'a, 'b> = node<'a, 'b> 5 | 6 | @attr 7 | type t 8 | 9 | @onFirst 10 | type t = s 11 | @onSecond 12 | and s = string 13 | } 14 | -------------------------------------------------------------------------------- /tests/ppx/react/interfaceWithRef.res: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make = React.forwardRef((~x: string, ref: Js.Nullable.t) => { 3 | let _ = ref->Js.Nullable.toOption->Belt.Option.map(ReactDOM.Ref.domRef) 4 | React.string(x) 5 | }) 6 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/valueBindingSugar.res.txt: -------------------------------------------------------------------------------- 1 | let /* before */ x /* after */: 2 | type t. (/* a */ int /* b */, /* c */ int /* d */) => /* e */ int = 3 | (/* c0 */ a /* c1 */, /* c2 */ b /* c3 */) => { 4 | // comment 5 | a + b 6 | } 7 | -------------------------------------------------------------------------------- /tests/printer/expr/expected/for.res.txt: -------------------------------------------------------------------------------- 1 | let () = for i in 0 to 10 { 2 | () 3 | } 4 | 5 | for i in 0 to 10 { 6 | let a = 1 7 | let b = 2 8 | sideEffect() 9 | } 10 | 11 | let x = 12 | @attr 13 | for i in 0 to 10 { 14 | () 15 | } 16 | -------------------------------------------------------------------------------- /tests/printer/typexpr/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | type t = %extension 2 | type t = @attr %extension 3 | 4 | external foo: %extension = "primitive" 5 | external foo: @attr %extension = "primitive" 6 | 7 | let x: %extension = z 8 | let x: @attr %extension = z 9 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/consecutive.res: -------------------------------------------------------------------------------- 1 | let f = (a,b) => a + 3b; 2 | 3 | let f = (g, h) => { 4 | a + 3b 5 | } 6 | 7 | let () = { 8 | sideEffect1() sideEffect2() 9 | } 10 | 11 | let () = { 12 | open Foo exception End 13 | x() 14 | } 15 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/ident.res: -------------------------------------------------------------------------------- 1 | module A = Array 2 | module A = Belt.Array 3 | 4 | include Array 5 | include Belt.Array 6 | 7 | module A = @attr Array 8 | module A = @attr Belt.Array 9 | 10 | include @attr Array 11 | include @attr Belt.Array 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/modExprExtension.res: -------------------------------------------------------------------------------- 1 | module A = %modExprExtension 2 | 3 | module B = %mod.expr.extension 4 | 5 | module C = %mod.expr.extension.with.args("argument") 6 | 7 | module D = %mod.expr.extension.with.args(x => f(x)) 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/typedef.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t 2 | type nonrec t 3 | and s 4 | type nonrec 'a t 5 | type nonrec 'a t 6 | and 'a s 7 | type nonrec ('a, 'b) t 8 | and ('a, 'b) s 9 | type nonrec 'a t = 'a node 10 | and 'b s = 'b edge -------------------------------------------------------------------------------- /tests/parsing/recovery/comments/expected/eof.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/comments/eof.res:2:1-3:0 4 | 5 | 1 │ let x = 1 6 | 2 │ /* eof 7 | 3 │ 8 | 9 | This comment seems to be missing a closing `*/` 10 | 11 | let x = 1 -------------------------------------------------------------------------------- /tests/printer/typexpr/var.res: -------------------------------------------------------------------------------- 1 | type t = 'a 2 | type t = @attr 'a 3 | 4 | type t = constr<'a> 5 | 6 | external foo: 'foo = "primitive" 7 | external foo: @attr 'foo = "primitive" 8 | 9 | let x: 'a = y 10 | let x: @attr 'a = y 11 | 12 | type x<'A> = 'A 13 | -------------------------------------------------------------------------------- /tests/idempotency/napkinscript/docComments.res: -------------------------------------------------------------------------------- 1 | /** This is a doc ✅ comment */ 2 | let z = 34 3 | 4 | @ns.doc("And this is a ns.doc ✅ annotation") 5 | let q = 11 6 | 7 | /** This 8 | * is a multi-line 9 | multiline doc comment 10 | */ 11 | type h = int 12 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesReview__Student.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let id = t => t.id 7 | let name = t => t.name 8 | 9 | let makeFromJs = jsObject => {id: jsObject["id"], name: jsObject["name"]} 10 | -------------------------------------------------------------------------------- /tests/parsing/errors/typexpr/typeConstructorArgs.res: -------------------------------------------------------------------------------- 1 | type node<'a> = { 2 | _value: Js.Nullable.value('a) 3 | } 4 | 5 | type t<'a> = Belt.Map.t('a) 6 | type t<'a> = private Belt.Map.t('a) 7 | 8 | type t = option<> 9 | type t = option(>) 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/expected/ident.res.txt: -------------------------------------------------------------------------------- 1 | module A = Array 2 | module A = Belt.Array 3 | include Array 4 | include Belt.Array 5 | module A = ((Array)[@attr ]) 6 | module A = ((Belt.Array)[@attr ]) 7 | include ((Array)[@attr ]) 8 | include ((Belt.Array)[@attr ]) -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/itemExtension.res.txt: -------------------------------------------------------------------------------- 1 | module type Ext = 2 | sig 3 | [%%item.extension ] 4 | [%%item.extension.with.args {js|argument|js}] 5 | [%%item.extension.with.args fun x -> f x] 6 | [%%item.extension ][@@withAttr ] 7 | end -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/poly.res.txt: -------------------------------------------------------------------------------- 1 | external getLogger : 2 | unit -> 3 | < 4 | log: 'a -> unit ;log2: 'a . int -> int ;log3: 'a 'b . 'a -> 'b -> int 5 | > = 6 | "./src/logger.mock.js" -------------------------------------------------------------------------------- /tests/parsing/other/attributes.res: -------------------------------------------------------------------------------- 1 | @attr(: int) 2 | let x = 1 3 | 4 | @attr(?var) 5 | let x = 1 6 | 7 | @attr(?var when x === 1) 8 | let x = 1 9 | 10 | %ext(: let x: int) 11 | %ext(: 12 | let x: int 13 | let y: float 14 | ) 15 | 16 | %%ext("A"; "B") 17 | -------------------------------------------------------------------------------- /tests/parsing/recovery/string/expected/emptyeof.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/string/emptyeof.res:1:9-2:0 4 | 5 | 1 │ let x = " 6 | 2 │ 7 | 8 | This string is missing a double quote at the end 9 | 10 | let x = {js| 11 | |js} -------------------------------------------------------------------------------- /tests/parsing/recovery/structure/expected/letBinding.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/structure/letBinding.res:1:8-9 4 | 5 | 1 │ let x = = doStuff(y) 6 | 2 │ 7 | 8 | This let-binding misses an expression 9 | 10 | let x = doStuff y -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__File.res: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | @get external _type: t => string = "type" 4 | 5 | @get external name: t => string = "name" 6 | 7 | @get external size: t => float = "size" 8 | 9 | @get external preview: t => string = "" 10 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/emptyeof.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/emptyeof.res:1:9-2:0 4 | 5 | 1 │ let x = " 6 | 2 │ 7 | 8 | This string is missing a double quote at the end 9 | 10 | let x = {js| 11 | |js} -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/expected/nativeint.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/scanner/nativeint.res:1:18 4 | 5 | 1 │ let nativeint = 3n 6 | 2 │ 7 | 8 | Unsupported number type (nativeint). Did you mean `3`? 9 | 10 | let nativeint = 3n -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/expected/unclosedComment.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/scanner/unclosedComment.res:1:1-3:0 4 | 5 | 1 │ /* eof 6 | 2 │ * reached 7 | 3 │ 8 | 9 | This comment seems to be missing a closing `*/` 10 | 11 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/expected/signature.res.txt: -------------------------------------------------------------------------------- 1 | module type BT = sig val x : int end 2 | module type BT = sig val x : int val y : int end 3 | module type BT = ((sig val x : int end)[@attr ]) 4 | module type BT = ((sig val x : int val y : int end)[@attr1 ][@attr2 ]) -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/typeDefinition.res: -------------------------------------------------------------------------------- 1 | type t = string 2 | type t = string and s = int 3 | type t = string and s = int and u = float 4 | 5 | type rec t = node 6 | type rec t = string and s = int 7 | type rec t = string and s = int and u = float 8 | 9 | -------------------------------------------------------------------------------- /tests/parsing/recovery/string/expected/eof.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/string/eof.res:1:9-2:0 4 | 5 | 1 │ let x = "eof here 6 | 2 │ 7 | 8 | This string is missing a double quote at the end 9 | 10 | let x = {js|eof here 11 | |js} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | *.cm* 3 | *.o 4 | *.s 5 | lib/* 6 | !lib/README.md 7 | .vscode/settings.json 8 | 9 | # Dune 10 | _build 11 | 12 | # Merlin 13 | .merlin 14 | 15 | # Local opam switch 16 | _opam/ 17 | 18 | # Output dir for bootstrap script 19 | bootstrap/ 20 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__NonElementParentNode.res: -------------------------------------------------------------------------------- 1 | /* Mixin */ 2 | module Impl = ( 3 | T: { 4 | type t 5 | }, 6 | ) => { 7 | @bs.send.pipe(: T.t) @return(nullable) external getElementById: string => option = "" 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/Components.res: -------------------------------------------------------------------------------- 1 | module HoverToggle = { 2 | @module("./HoverToggle.js") @react.component 3 | external make: ( 4 | ~_ComponentHover: React.element, 5 | ~_ComponentNoHover: React.element, 6 | ) => React.element = "default" 7 | } 8 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/expected/patternMatching.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/other/patternMatching.res:1:14-2:1 4 | 5 | 1 │ switch expr { 6 | 2 │ } 7 | 3 │ 8 | 9 | Pattern matching needs at least one case 10 | 11 | ;;match expr with -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/ident.res: -------------------------------------------------------------------------------- 1 | let x = foo 2 | 3 | let y = Foo.Bar.x 4 | 5 | let x = _identWithUnderscore 6 | let x = _ident_ident 7 | let x = _ident_ident_ 8 | let x = __ident__ 9 | 10 | let x = list 11 | let x = Foo.Bar.list 12 | 13 | let with = with 14 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/signature.res: -------------------------------------------------------------------------------- 1 | module type BT = { let x: int } 2 | module type BT = { 3 | let x: int 4 | let y: int 5 | } 6 | 7 | module type BT = @attr { let x: int } 8 | module type BT = @attr1 @attr2 { 9 | let x: int 10 | let y: int 11 | } 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/typeDefinition.res.txt: -------------------------------------------------------------------------------- 1 | module type Signature = 2 | sig 3 | type nonrec t 4 | type nonrec ('a, 'b) t = ('a, 'b) node 5 | type nonrec t[@@attr ] 6 | type nonrec t = s[@@onFirst ] 7 | and s = string[@@onSecond ] 8 | end -------------------------------------------------------------------------------- /tests/printer/comments/structure3.res: -------------------------------------------------------------------------------- 1 | node.left->peekMinNode 2 | // same as the above 3 | (node.left)->peekMinNode 4 | 5 | // field access has higher precedence than unary - 6 | let x = -a.bar 7 | 8 | let a = 1 9 | 10 | /* test */ 11 | let b = 2 12 | // a 13 | // b 14 | -------------------------------------------------------------------------------- /tests/printer/typexpr/expected/var.res.txt: -------------------------------------------------------------------------------- 1 | type t = 'a 2 | type t = @attr 'a 3 | 4 | type t = constr<'a> 5 | 6 | external foo: 'foo = "primitive" 7 | external foo: @attr 'foo = "primitive" 8 | 9 | let x: 'a = y 10 | let x: @attr 'a = y 11 | 12 | type x<'A> = 'A 13 | -------------------------------------------------------------------------------- /tests/idempotency/mareo/Procedural_generator.resi: -------------------------------------------------------------------------------- 1 | open Object 2 | 3 | type obj_coord 4 | 5 | let init: unit => unit 6 | 7 | /* Procedurally generates a new map of default size */ 8 | let generate: (float, float, Dom_html.canvasRenderingContext2D) => (collidable, list) 9 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/ifLet.res: -------------------------------------------------------------------------------- 1 | if let Some(x) = result { 2 | Js.log("The sky is blue") 3 | } 4 | 5 | if let Error(x) = result { 6 | Js.log("The sky is red") 7 | } else if let Ok(y) = result { 8 | Js.log("The sky is blue") 9 | } else { 10 | () 11 | } 12 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/regionMissingComma.res: -------------------------------------------------------------------------------- 1 | external make: ( 2 | ~style: ReactDOMRe.Style.t=?. 3 | ~image: bool=?, 4 | ) => React.element = "ModalContent" 5 | 6 | type student<'extraInfo> = { 7 | name: string, 8 | age: int 9 | otherInfo: 'extraInfo 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/errors/scanner/expected/unclosedString.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/scanner/unclosedString.res:1:9-2:0 4 | 5 | 1 │ let z = "eof 6 | 2 │ 7 | 8 | This string is missing a double quote at the end 9 | 10 | let z = {js|eof 11 | |js} -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/moduleTypeExtension.res.txt: -------------------------------------------------------------------------------- 1 | module type A = [%modTypeExtension ] 2 | module type B = [%mod.type.extension ] 3 | module type C = [%mod.type.extension.with.args {js|argument|js}] 4 | module type D = [%mod.type.extension.with.args fun x -> f x] -------------------------------------------------------------------------------- /tests/printer/other/char.res: -------------------------------------------------------------------------------- 1 | let x = 'a' 2 | let x = '\\' 3 | let x = '\'' 4 | let x = '\n' 5 | let x = '\t' 6 | let x = '\b' 7 | let x = '\r' 8 | let x = ' ' 9 | let x = '\o021' 10 | let x = '\xAA' 11 | let x = '\179' 12 | let heart = '\u2665' 13 | let smile2 = '\u{1F600}' 14 | -------------------------------------------------------------------------------- /tests/idempotency/reason-react/src/ReactDOMServerRe.res: -------------------------------------------------------------------------------- 1 | @val @module("react-dom/server") 2 | external renderToString: React.element => string = "renderToString" 3 | 4 | @val @module("react-dom/server") 5 | external renderToStaticMarkup: React.element => string = "renderToStaticMarkup" 6 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/moduleTypeExtension.res: -------------------------------------------------------------------------------- 1 | module type A = %modTypeExtension 2 | 3 | module type B = %mod.type.extension 4 | 5 | module type C = %mod.type.extension.with.args("argument") 6 | 7 | module type D = %mod.type.extension.with.args(x => f(x)) 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/ppx/react/expected/interface.resi.txt: -------------------------------------------------------------------------------- 1 | module A: { 2 | type props<'x> = {x: 'x} 3 | let make: React.componentLike, React.element> 4 | } 5 | 6 | module NoProps: { 7 | type props = {} 8 | 9 | let make: React.componentLike 10 | } 11 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/structure3.res.txt: -------------------------------------------------------------------------------- 1 | node.left->peekMinNode 2 | // same as the above 3 | node.left->peekMinNode 4 | 5 | // field access has higher precedence than unary - 6 | let x = -a.bar 7 | 8 | let a = 1 9 | 10 | /* test */ 11 | let b = 2 12 | // a 13 | // b 14 | -------------------------------------------------------------------------------- /tests/idempotency/nook-exchange/PageTitle.res: -------------------------------------------------------------------------------- 1 | module Styles = { 2 | open Css 3 | let pageTitle = style(list{fontSize(px(32)), textAlign(center), marginBottom(px(16))}) 4 | } 5 | 6 | @react.component 7 | let make = (~title) =>
{React.string(title)}
8 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_Header.resi: -------------------------------------------------------------------------------- 1 | let add: (Warp_Types_Client.t<'a>, string, string) => Warp_Types_Client.t<'a> 2 | 3 | let set: (Warp_Types_Client.t<'a>, list<(string, string)>) => Warp_Types_Client.t<'a> 4 | 5 | let remove: (Warp_Types_Client.t<'a>, string) => Warp_Types_Client.t<'a> 6 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/spread.res: -------------------------------------------------------------------------------- 1 | let arr = [...x, ...y] 2 | let [...arr, _] = [1, 2, 3] 3 | 4 | let record = {...x, ...y} 5 | let {...x, ...y} = myRecord 6 | 7 | let list{...x, ...y} = myList 8 | 9 | type t = {...a} 10 | type t = Foo({...a}) 11 | type t = option 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/list.res.txt: -------------------------------------------------------------------------------- 1 | let x = [] 2 | let x = [1; 2; 3] 3 | let x = [1; 2; 3] 4 | let x = [(1 : int); (2 : int); (3 : int)] 5 | let x = 4 :: 5 :: y 6 | let x = ((Belt.List.concatMany)[@res.spread ]) [|(1 :: x);(2 :: 3 :: x)|] 7 | let x = 1 :: 2 :: (y : int list) -------------------------------------------------------------------------------- /tests/conversion/reason/jsObject.resi: -------------------------------------------------------------------------------- 1 | type propField<'a> = {.} 2 | type propField<'a> = {..} as 'a 3 | type propField<'a> = {..} as 'a 4 | type propField<'a> = Js.nullable<{..} as 'a> 5 | 6 | type propField<'a> = {"a": b} 7 | type propField<'a> = {.."a": b} 8 | type propField<'a> = {"a": {"b": c}} 9 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__CustomEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.customEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "CustomEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "CustomEvent" 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/StudentsEditor__Level.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | let name: t => string 4 | 5 | let number: t => int 6 | 7 | let id: t => string 8 | 9 | let decode: Js.Json.t => t 10 | 11 | let title: t => string 12 | 13 | let unsafeFind: (array, string, string) => t 14 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_QueryString.resi: -------------------------------------------------------------------------------- 1 | let add: (Warp_Types_Client.t<'a>, string, string) => Warp_Types_Client.t<'a> 2 | 3 | let set: (Warp_Types_Client.t<'a>, list<(string, string)>) => Warp_Types_Client.t<'a> 4 | 5 | let remove: (Warp_Types_Client.t<'a>, string) => Warp_Types_Client.t<'a> 6 | -------------------------------------------------------------------------------- /tests/printer/other/expected/char.res.txt: -------------------------------------------------------------------------------- 1 | let x = 'a' 2 | let x = '\\' 3 | let x = '\'' 4 | let x = '\n' 5 | let x = '\t' 6 | let x = '\b' 7 | let x = '\r' 8 | let x = ' ' 9 | let x = '\o021' 10 | let x = '\xAA' 11 | let x = '\179' 12 | let heart = '\u2665' 13 | let smile2 = '\u{1F600}' 14 | -------------------------------------------------------------------------------- /src/res_io.mli: -------------------------------------------------------------------------------- 1 | (* utilities to read and write to/from files or stdin *) 2 | 3 | (* reads the contents of "filename" into a string *) 4 | val readFile : filename:string -> string 5 | 6 | (* writes "content" into file with name "filename" *) 7 | val writeFile : filename:string -> contents:string -> unit 8 | -------------------------------------------------------------------------------- /tests/idempotency/genType/src/ResolvedName.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | type eq = (t, t) 4 | 5 | let applyEquations: (~eqs: list, t) => list 6 | 7 | let dot: (string, t) => t 8 | 9 | let fromString: string => t 10 | 11 | let toList: t => list 12 | 13 | let toString: t => string 14 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/WindowUtils.res: -------------------------------------------------------------------------------- 1 | let confirm = (~onCancel=?, message, f) => 2 | if { 3 | open Webapi.Dom 4 | window |> Window.confirm(message) 5 | } { 6 | f() 7 | } else { 8 | onCancel |> OptionUtils.mapWithDefault(onCancel => onCancel(), ()) 9 | } 10 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/polyvariant.res.txt: -------------------------------------------------------------------------------- 1 | let x = `Red 2 | let z = `Rgb () 3 | let v = `Vertex (1., 2., 3., 4.) 4 | let animation = `ease-in 5 | let one = `1 6 | let fortyTwo = `42 7 | let long = `42444 8 | let oneString = `1 {js|payload|js} 9 | let twoIntString = `2 (3, {js|payload|js}) -------------------------------------------------------------------------------- /tests/printer/other/reasonArity.res: -------------------------------------------------------------------------------- 1 | let _ = Constructor(a, b) 2 | let _ = Constructor((a, b)) 3 | let _ = #Constructor(a, b) 4 | let _ = #Constructor(a, b) 5 | 6 | switch a { 7 | | C(c, d) => 1 8 | | C((c, d)) => 1 9 | } 10 | 11 | switch a { 12 | | #C(c, d) => 1 13 | | #C(c, d) => 1 14 | } 15 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/expected/for.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/other/for.res:1:6-2:0 4 | 5 | 1 │ for x 6 | 2 │ 7 | 8 | Did you forget a `in` here? 9 | 10 | ;;for x = [%rescript.exprhole ] to [%rescript.exprhole ] do 11 | [%rescript.exprhole ] 12 | done -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/open.res: -------------------------------------------------------------------------------- 1 | module type Signature = { 2 | open Belt 3 | open! Belt 4 | 5 | open Belt.Array 6 | open! Belt.Array 7 | 8 | @attr 9 | open Belt 10 | @attr 11 | open! Belt 12 | 13 | @attr 14 | open Belt.List 15 | @attr 16 | open! Belt.List 17 | } 18 | -------------------------------------------------------------------------------- /.ocamlformat: -------------------------------------------------------------------------------- 1 | profile = default 2 | version = 0.22.4 3 | 4 | field-space = tight-decl 5 | break-cases = toplevel 6 | module-item-spacing = preserve 7 | cases-exp-indent = 2 8 | space-around-arrays = false 9 | space-around-lists = false 10 | space-around-records = false 11 | space-around-variants = false 12 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/jsObject.resi.txt: -------------------------------------------------------------------------------- 1 | type propField<'a> = {.} 2 | type propField<'a> = {..} as 'a 3 | type propField<'a> = {..} as 'a 4 | type propField<'a> = Js.nullable<{..} as 'a> 5 | 6 | type propField<'a> = {"a": b} 7 | type propField<'a> = {.."a": b} 8 | type propField<'a> = {"a": {"b": c}} 9 | -------------------------------------------------------------------------------- /tests/idempotency/covid-19charts.com/src/Colors.res: -------------------------------------------------------------------------------- 1 | let colors = { 2 | "activeblue": "#0099FF", 3 | "grayblue": "#ACBBCB", 4 | "bggray": "#F0F1F2", 5 | "fggray": "#A4A4A4", 6 | "white": "#FFFFFF", 7 | "black": "#000000", 8 | "lightgrayblue": "#DBE3EC", 9 | "darkgray": "#494949", 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/expected/consecutive.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/structure/consecutive.res:1:9-18 4 | 5 | 1 │ open Foo exception Bar 6 | 2 │ 7 | 8 | consecutive statements on a line must be separated by ';' or a newline 9 | 10 | open Foo 11 | exception Bar -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/apply.res: -------------------------------------------------------------------------------- 1 | foo(_ => bla, blaz) 2 | foo((_) => bla, blaz) 3 | foo((. _) => bla, blaz) 4 | foo(_ => bla, _ => blaz) 5 | 6 | List.map(x => x + 1, myList) 7 | List.reduce((acc, curr) => acc + curr, 0, myList) 8 | 9 | let unitUncurried = apply(.) 10 | 11 | call(~a: int) 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/open.res.txt: -------------------------------------------------------------------------------- 1 | module type Signature = 2 | sig 3 | open Belt 4 | open! Belt 5 | open Belt.Array 6 | open! Belt.Array 7 | open Belt[@@attr ] 8 | open! Belt[@@attr ] 9 | open Belt.List[@@attr ] 10 | open! Belt.List[@@attr ] 11 | end -------------------------------------------------------------------------------- /tests/parsing/grammar/typedefinition/expected/typeDefinition.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = string 2 | type nonrec t = string 3 | and s = int 4 | type nonrec t = string 5 | and s = int 6 | and u = float 7 | type t = t node 8 | type t = string 9 | and s = int 10 | type t = string 11 | and s = int 12 | and u = float -------------------------------------------------------------------------------- /tests/printer/pattern/firstClassModules.res: -------------------------------------------------------------------------------- 1 | let module(Set) = z 2 | let module(Set : Set.S with type elt = s) = y 3 | let module(Set : Set.S with type elt = s and type elt2 = t) = x 4 | let module(Set : Set.S with type elt = s and type elt2 = t and type elementWithSuperLongName = thisIsALongTypeOverHere) = x 5 | -------------------------------------------------------------------------------- /tests/idempotency/bs-css/Css_Core.res: -------------------------------------------------------------------------------- 1 | module type CssImplementationIntf = { 2 | let mergeStyles: (. array) => string 3 | let injectRule: (. Js.Json.t) => unit 4 | let injectRaw: (. string) => unit 5 | let make: (. Js.Json.t) => string 6 | let makeKeyFrames: (. Js.Dict.t) => string 7 | } 8 | -------------------------------------------------------------------------------- /tests/printer/other/expected/reasonArity.res.txt: -------------------------------------------------------------------------------- 1 | let _ = Constructor(a, b) 2 | let _ = Constructor((a, b)) 3 | let _ = #Constructor(a, b) 4 | let _ = #Constructor(a, b) 5 | 6 | switch a { 7 | | C(c, d) => 1 8 | | C((c, d)) => 1 9 | } 10 | 11 | switch a { 12 | | #C(c, d) => 1 13 | | #C(c, d) => 1 14 | } 15 | -------------------------------------------------------------------------------- /tests/idempotency/reason-react-hackernews/app.res: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make = () => { 3 | let url = ReasonReact.Router.useUrl() 4 | 5 | switch url.path { 6 | | list{} => 7 | | list{"comments", id} => 8 | | _ => 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/if.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/if.res:2:11-3:5 4 | 5 | 1 │ // missing brace below 6 | 2 │ if (match) 7 | 3 │ let a = 1 8 | 4 │ a + 1 9 | 5 │ } 10 | 11 | Did you forget a `{` here? 12 | 13 | ;;if match then let a = 1 in a + 1 -------------------------------------------------------------------------------- /tests/parsing/errors/structure/expected/closingBraces.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/structure/closingBraces.res:3:1 4 | 5 | 1 │ let x = 1 6 | 2 │ 7 | 3 │ }}} 8 | 4 │ 9 | 5 │ let y = 2 10 | 11 | I'm not sure what to parse here when looking at "}". 12 | 13 | let x = 1 14 | let y = 2 -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/typeof.res: -------------------------------------------------------------------------------- 1 | module type MyHash = { 2 | include module type of { include Hashtbl } 3 | let replace: (t<'a, 'b>, 'a, 'b) => unit 4 | } 5 | 6 | module type MyHash = { 7 | include @onModuleTypeOf module type of { include Hashtbl } 8 | let replace: (t<'a, 'b>, 'a, 'b) => unit 9 | } 10 | -------------------------------------------------------------------------------- /tests/printer/pattern/type.res: -------------------------------------------------------------------------------- 1 | let #...shape = x 2 | let #...\"Shape" = x 3 | let #...\"type" = x 4 | let #...\"test 🏚" = x 5 | let #...\"Shape✅" = x 6 | 7 | switch (selectedChoice, value) { 8 | | (#...A.a, #...A.a) => true 9 | | (#...A.b, #...A.b) => true 10 | | (#...A.c, #...A.c) => true 11 | | _ => false 12 | } 13 | -------------------------------------------------------------------------------- /tests/parsing/errors/signature/expected/closingBraces.resi.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/signature/closingBraces.resi:3:1 4 | 5 | 1 │ let x: int 6 | 2 │ 7 | 3 │ }}} 8 | 4 │ 9 | 5 │ let y: int 10 | 11 | I'm not sure what to parse here when looking at "}". 12 | 13 | val x : int 14 | val y : int -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/expected/namedParameters.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/typeDef/namedParameters.res:1:15-20 4 | 5 | 1 │ type draw = (stroke: pencil) => unit 6 | 2 │ 7 | 8 | A labeled parameter starts with a `~`. Did you mean: `~stroke`? 9 | 10 | type nonrec draw = stroke:pencil -> unit -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/expected/jsx.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/expression/jsx.res:1:14 4 | 5 | 1 │ let x =
6 | 2 │ 7 | 8 | I'm not sure what to parse here when looking at "@". 9 | 10 | let x = ((div ~children:[] ())[@JSX ]) 11 | [@@@ ] 12 | ;;[%rescript.exprhole ][@@ ] -------------------------------------------------------------------------------- /tests/printer/typexpr/exoticIdent.res: -------------------------------------------------------------------------------- 1 | type s = \"type" 2 | type s = '\"type" 3 | type s = \"module" as '\"type" 4 | 5 | type s = (~\"let": \"type") => \"module" 6 | 7 | type t = (\"let", \"module", \"type") 8 | 9 | type t = Foo.list 10 | type t = Foo.\"let"<\"let", \"module"> 11 | 12 | let f: 'a. \"let" => \"type" = () 13 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/array.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/array.res:2:44 4 | 5 | 1 │ // missing ] before ) 6 | 2 │ let xs = x.map(key => [key, predicates[key]) 7 | 3 │ 8 | 9 | Did you forget a `]` here? 10 | 11 | let xs = x.map (fun key -> [|key;(predicates.(key))|]) -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/taggedTemplateLiterals.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/taggedTemplateLiterals.res:1:1-5 4 | 5 | 1 │ foo()`null` 6 | 2 │ 7 | 8 | Tagged template literals are currently restricted to names like: json`null`. 9 | 10 | ;;(({js|null|js})[@res.template ]) -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/expected/record.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/typeDef/record.res:4:1 4 | 5 | 2 │ observed: int, 6 | 3 │ observer: 7 | 4 │ } 8 | 5 │ 9 | 10 | I'm missing a type here 11 | 12 | type nonrec observation = { 13 | observed: int ; 14 | observer: [%rescript.typehole ] } -------------------------------------------------------------------------------- /tests/printer/comments/whitespaceTrailingLeading.res: -------------------------------------------------------------------------------- 1 | let a = 1 // single line trailing 2 | // leading 3 | let b = 2 4 | 5 | let a = 1 /* comment */ 6 | // leading 7 | let b = 2 8 | 9 | let a = 1 // single line trailing 10 | 11 | // leading 12 | let b = 2 13 | 14 | let a = 1 /* comment */ 15 | 16 | // leading 17 | let b = 2 18 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/firstClassModules.res.txt: -------------------------------------------------------------------------------- 1 | let module(Set) = z 2 | let module(Set: Set.S with type elt = s) = y 3 | let module(Set: Set.S with type elt = s and type elt2 = t) = x 4 | let module(Set: Set.S with 5 | type elt = s 6 | and type elt2 = t 7 | and type elementWithSuperLongName = thisIsALongTypeOverHere 8 | ) = x 9 | -------------------------------------------------------------------------------- /tests/printer/pattern/expected/type.res.txt: -------------------------------------------------------------------------------- 1 | let #...shape = x 2 | let #...\"Shape" = x 3 | let #...\"type" = x 4 | let #...\"test 🏚" = x 5 | let #...\"Shape✅" = x 6 | 7 | switch (selectedChoice, value) { 8 | | (#...A.a, #...A.a) => true 9 | | (#...A.b, #...A.b) => true 10 | | (#...A.c, #...A.c) => true 11 | | _ => false 12 | } 13 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/users/UsersHome__Community.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let name = t => t.name 7 | let id = t => t.id 8 | 9 | let decode = json => { 10 | open Json.Decode 11 | { 12 | id: json |> field("id", string), 13 | name: json |> field("name", string), 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/Accounting.res: -------------------------------------------------------------------------------- 1 | open Belt.Option 2 | 3 | let defaultZeroF = maybeFloat => mapWithDefault(maybeFloat, 0., a => a) 4 | let defaultZeroI = maybeInt => mapWithDefault(maybeInt, -1, a => a) 5 | let defaultZeroS = maybeString => mapWithDefault(maybeString, "0", a => a) 6 | 7 | let dummyTimes2 = (a: int) => a * 2 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/pattern/expected/or.res.txt: -------------------------------------------------------------------------------- 1 | ;;match x with 2 | | Blue|Red -> () 3 | | Blue|Red as colour -> () 4 | | Blue as c1|Red as c2 -> () 5 | | Blue as c1|Red as c2 -> () 6 | | exception Exit|exception Continue -> () 7 | | exception (Exit|exception Continue) -> () 8 | | (lazy x)|(lazy y) -> () 9 | | (lazy (x|(lazy y))) -> () -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/unit.res: -------------------------------------------------------------------------------- 1 | type t = () 2 | type t = () => () 3 | type t = ((), ()) => () 4 | 5 | type t = (()) => () 6 | 7 | let f = (f: () => ()) => f() 8 | let f = (f: (()) => ()) => f() 9 | let f = (f: ((), ()) => ()) => f((), ()) 10 | 11 | external svg: () => React.element = "svg" 12 | external thing: () => () = "svg" 13 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/layouts/StudentCourse__Course.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let decode = json => { 7 | open Json.Decode 8 | { 9 | id: json |> field("id", string), 10 | name: json |> field("name", string), 11 | } 12 | } 13 | 14 | let id = t => t.id 15 | let name = t => t.name 16 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/SchoolCustomize__UpdateSchoolStringError.res: -------------------------------------------------------------------------------- 1 | type t = [#InvalidKey | #InvalidLengthValue | #InvalidValue] 2 | 3 | let notification = error => 4 | switch error { 5 | | #InvalidKey => ("InvalidKey", "") 6 | | #InvalidValue => ("InvalidValue", "") 7 | | #InvalidLengthValue => ("InvalidLengthValue", "") 8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/StudentsEditor__Coach.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let name = t => t.name 7 | let id = t => t.id 8 | 9 | let decode = json => { 10 | open Json.Decode 11 | { 12 | id: json |> field("id", string), 13 | name: json |> field("name", string), 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/components/Meta.res: -------------------------------------------------------------------------------- 1 | module Head = Next.Head 2 | 3 | @react.component 4 | let make = () => 5 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/record.res: -------------------------------------------------------------------------------- 1 | let newWrapper = { 2 | updateF 3 | value: f(xWrapper.currentValue), 4 | } 5 | 6 | 7 | let newWrapper = { 8 | updateF updateF2 9 | value: f(xWrapper.currentValue), 10 | } 11 | 12 | let record = { 13 | field: 14 | } 15 | 16 | 17 | let record = { 18 | field: 19 | } 20 | 2 21 | } 22 | -------------------------------------------------------------------------------- /tests/parsing/errors/other/breadcrumbs170.res: -------------------------------------------------------------------------------- 1 | // it should report an error on the `}` on line 9 2 | let l = Some(list{1, 2, 3}) |> Obj.magic 3 | module M = { 4 | switch l { 5 | | None => list{} 6 | | Some(l) => l["prop"] 7 | } 8 | } 9 | }from now on all syntax is "valid", 10 | it compiles and will be ignored in js/ removed on format 11 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/polyvariant.res: -------------------------------------------------------------------------------- 1 | let x = #Red 2 | 3 | // sugar for Rgb(()) 4 | let z = #Rgb() 5 | 6 | let v = #Vertex(1., 2., 3., 4.) 7 | 8 | let animation = #"ease-in" 9 | 10 | let one = #1 11 | let fortyTwo = #42 12 | let long = #42444 13 | 14 | let oneString = #1("payload") 15 | let twoIntString = #2(3, "payload") 16 | -------------------------------------------------------------------------------- /tests/parsing/grammar/pattern/or.res: -------------------------------------------------------------------------------- 1 | switch x { 2 | | Blue | Red => () 3 | | (Blue | Red) as colour => () 4 | | Blue as c1 | Red as c2 => () 5 | | (Blue as c1) | (Red as c2) => () 6 | | exception Exit | exception Continue => () 7 | | exception (Exit | exception Continue) => () 8 | | lazy x | lazy y => () 9 | | lazy (x | lazy y) => () 10 | } 11 | -------------------------------------------------------------------------------- /tests/printer/comments/expected/whitespaceTrailingLeading.res.txt: -------------------------------------------------------------------------------- 1 | let a = 1 // single line trailing 2 | // leading 3 | let b = 2 4 | 5 | let a = 1 /* comment */ 6 | // leading 7 | let b = 2 8 | 9 | let a = 1 // single line trailing 10 | 11 | // leading 12 | let b = 2 13 | 14 | let a = 1 /* comment */ 15 | 16 | // leading 17 | let b = 2 18 | -------------------------------------------------------------------------------- /tests/printer/expr/jsObjectSet.res: -------------------------------------------------------------------------------- 1 | address["street"] = "Brusselsestraat" 2 | address["street"] = newYork |> getExpensiveStreet 3 | 4 | let () = @attr address["street"] = "Brusselsestraat" 5 | let () = node["left"] = value |> process |> node["right"] = value |> process 6 | let () = (node["left"] = value |> process) |> node["right"] = value |> process 7 | -------------------------------------------------------------------------------- /tests/printer/structure/external.res: -------------------------------------------------------------------------------- 1 | @val external null: reactElement = "null"; 2 | 3 | external string: string => reactElement = "%identity"; 4 | 5 | external array: array => reactElement = "%identity"; 6 | 7 | external refToJsObj: reactRef => {..} = "%identity"; 8 | 9 | external \"type": \"let" => \"Uident" = "unsafe_call" 10 | -------------------------------------------------------------------------------- /tests/printer/structure/recModules.res: -------------------------------------------------------------------------------- 1 | module rec A: Map = { let m = 2} 2 | and B: Set = {let s = 1} 3 | 4 | @onFirstBinding 5 | module rec A: Map = { let m = 2} 6 | @onSecondBinding 7 | and B: Set = {let s = 1} 8 | 9 | @onFirstBindingOfNext 10 | module rec A: Map = { let m = 2} 11 | @onSecondBindingOfNext 12 | and B: Set = {let s = 1} 13 | -------------------------------------------------------------------------------- /tests/printer/typexpr/expected/exoticIdent.res.txt: -------------------------------------------------------------------------------- 1 | type s = \"type" 2 | type s = '\"type" 3 | type s = \"module" as '\"type" 4 | 5 | type s = (~\"let": \"type") => \"module" 6 | 7 | type t = (\"let", \"module", \"type") 8 | 9 | type t = Foo.list 10 | type t = Foo.\"let"<\"let", \"module"> 11 | 12 | let f: 'a. \"let" => \"type" = () 13 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__Image__test.res: -------------------------------------------------------------------------------- 1 | open Webapi.Dom.Image 2 | 3 | let imageData = make(~width=0.0, ~height=0.0) 4 | 5 | let arr = Js.Typed_array.Uint8ClampedArray.make([]) 6 | let _ = makeWithData(~array=arr, ~width=0.0, ~height=0.0) 7 | 8 | let _ = height(imageData) 9 | let _ = width(imageData) 10 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesCurriculum__Learn.res: -------------------------------------------------------------------------------- 1 | open CoursesCurriculum__Types 2 | 3 | @react.component 4 | let make = (~targetDetails) => { 5 | let contentBlocks = 6 | targetDetails |> TargetDetails.contentBlocks |> Array.of_list |> ContentBlock.sort 7 |
8 | } 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseCoaches__SchoolCoach.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let id = t => t.id 7 | let name = t => t.name 8 | 9 | let decode = json => { 10 | open Json.Decode 11 | { 12 | id: json |> field("id", string), 13 | name: json |> field("name", string), 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/SocialButtons.res: -------------------------------------------------------------------------------- 1 | @module("@wildcards/react-social-icons") @react.component 2 | external make: ( 3 | ~url: string=?, 4 | ~bgColor: string=?, 5 | ~fgColor: string=?, 6 | ~target: string=?, 7 | ~className: string=?, 8 | ~rel: string=?, 9 | ~network: string=?, 10 | ) => React.element = "SocialIcon" 11 | -------------------------------------------------------------------------------- /tests/ppx/react/expected/commentAtTop.res.txt: -------------------------------------------------------------------------------- 1 | type props<'msg> = {msg: 'msg} // test React JSX file 2 | 3 | let make = ({msg, _}: props<_>) => { 4 | ReactDOM.jsx("div", {children: ?ReactDOM.someElement({msg->React.string})}) 5 | } 6 | let make = { 7 | let \"CommentAtTop" = (props: props<_>) => make(props) 8 | 9 | \"CommentAtTop" 10 | } 11 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__PopStateEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.popStateEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "PopStateEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "PopStateEvent" 9 | 10 | @get external state: t => {..} = "" 11 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesCurriculum__Coach.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | userId: string, 4 | } 5 | 6 | let id = t => t.id 7 | let userId = t => t.userId 8 | 9 | let decode = json => { 10 | open Json.Decode 11 | { 12 | id: json |> field("id", string), 13 | userId: json |> field("userId", string), 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/InactiveStudentsPanel__Team.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let id = t => t.id 7 | 8 | let name = t => t.name 9 | 10 | let decode = json => { 11 | open Json.Decode 12 | { 13 | id: json |> field("id", string), 14 | name: json |> field("name", string), 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/DateTime.resi: -------------------------------------------------------------------------------- 1 | type t = Js.Date.t 2 | 3 | type format = 4 | | OnlyDate 5 | | DateWithYearAndTime 6 | 7 | let parse: string => t 8 | 9 | let format: (format, t) => string 10 | 11 | let stingToFormatedTime: (format, string) => string 12 | 13 | let randomId: unit => string 14 | 15 | let decode: Js.Json.t => t 16 | -------------------------------------------------------------------------------- /tests/idempotency/wildcards-world-ui/Validate.res: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make = () => { 3 | let goToVerifyUser = RootProvider.useVerifyUser() 4 | 5 | 6 | 7 | goToVerifyUser()}> {React.string("Profile")} 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/for.res: -------------------------------------------------------------------------------- 1 | for p in 0 to 10 { 2 | () 3 | } 4 | 5 | for p in 10 downto 0 { 6 | () 7 | } 8 | 9 | for (p in a to b) { 10 | () 11 | } 12 | 13 | for (p in a to b) { 14 | let a = 1 15 | let b = 2 16 | a + b 17 | } 18 | 19 | // (x +1) { -> not an arrow expression 20 | for p in 0 to (x + 1) { 21 | () 22 | } 23 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/ident.res: -------------------------------------------------------------------------------- 1 | module type BT = BTree 2 | module type BT = MultiCore.BTree 3 | module type BT = Std.MultiCore.BTree 4 | 5 | module type BT = @attr BTree 6 | module type BT = @attr @attr2 MultiCore.BTree 7 | module type BT = @attr @attr2 @attr3 Std.MultiCore.BTree 8 | 9 | module type list = list 10 | module type t = s 11 | -------------------------------------------------------------------------------- /tests/ppx/react/optimizeAutomaticMode.res: -------------------------------------------------------------------------------- 1 | @@jsxConfig({version: 4, mode: "automatic"}) 2 | 3 | module User = { 4 | type t = {firstName: string, lastName: string} 5 | 6 | let format = user => "Dr." ++ user.lastName 7 | 8 | @react.component 9 | let make = (~doctor) => { 10 |

{React.string(format(doctor))}

11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/printer/pattern/list.res: -------------------------------------------------------------------------------- 1 | let list{} = 1 2 | let list{1} = 1 3 | let list{1, 2} = 1 4 | let list{1, 2, 3} = 1 5 | let list{1, 2, ...tail} = 1 6 | 7 | let list{aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc} = 1 8 | let list{aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc, ...tail} = 1 9 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/external.res.txt: -------------------------------------------------------------------------------- 1 | @val external null: reactElement = "null" 2 | 3 | external string: string => reactElement = "%identity" 4 | 5 | external array: array => reactElement = "%identity" 6 | 7 | external refToJsObj: reactRef => {..} = "%identity" 8 | 9 | external \"type": \"let" => \"Uident" = "unsafe_call" 10 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/layouts/StudentTopNav__NavLink.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | title: string, 3 | url: string, 4 | } 5 | 6 | let title = t => t.title 7 | 8 | let url = t => t.url 9 | 10 | let decode = json => { 11 | open Json.Decode 12 | { 13 | title: json |> field("title", string), 14 | url: json |> field("url", string), 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/idempotency/reasonml.org/components/Tag.res: -------------------------------------------------------------------------------- 1 | open Util.ReactStuff 2 | 3 | type kind = [#Subtle] 4 | 5 | @react.component 6 | let make = (~text, ~kind=#Subtle) => { 7 | let className = switch kind { 8 | | #Subtle => "px-1 bg-snow-dark text-night-60 font-semibold rounded text-sm" 9 | } 10 |
{text->s}
11 | } 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/recursiveModules.res: -------------------------------------------------------------------------------- 1 | module rec A: Map = { let m = 2} 2 | and B: Set = {let s = 1} 3 | 4 | @onFirstBinding 5 | module rec A: Map = { let m = 2} 6 | @onSecondBinding 7 | and B: Set = {let s = 1} 8 | 9 | @onFirstBindingOfNext 10 | module rec A: Map = { let m = 2} 11 | @onSecondBindingOfNext 12 | and B: Set = {let s = 1} 13 | -------------------------------------------------------------------------------- /tests/ppx/react/lowercases.res: -------------------------------------------------------------------------------- 1 | @@jsxConfig({version:4, mode:"classic"}) 2 | 3 | let _ =
4 | let _ =
5 | let _ =
6 | let _ =

{React.string(x)}

7 | let _ =
8 | let _ =
9 | 10 | // syntax error 11 | // let _ =
12 | // let _ =
-------------------------------------------------------------------------------- /tests/printer/expr/expected/jsObjectSet.res.txt: -------------------------------------------------------------------------------- 1 | address["street"] = "Brusselsestraat" 2 | address["street"] = newYork |> getExpensiveStreet 3 | 4 | let () = @attr address["street"] = "Brusselsestraat" 5 | let () = node["left"] = value |> process |> node["right"] = value |> process 6 | let () = (node["left"] = value |> process) |> node["right"] = value |> process 7 | -------------------------------------------------------------------------------- /tests/printer/modExpr/structure.res: -------------------------------------------------------------------------------- 1 | module StringArray = { 2 | type t = array 3 | 4 | let empty = [] 5 | } 6 | 7 | module Empty = {} 8 | 9 | module Empty = { 10 | // TODO: convince management to implement this 11 | } 12 | 13 | module Empty = {/* test */} 14 | 15 | module EmptyModule = { 16 | /* TODO: management on vacation */ 17 | } 18 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__NonDocumentTypeChildNode.res: -------------------------------------------------------------------------------- 1 | /* Mixin */ 2 | module Impl = ( 3 | T: { 4 | type t 5 | }, 6 | ) => { 7 | @get @return(nullable) external previousElementSibling: T.t => option = "" 8 | @get @return(nullable) external nextElementSibling: T.t => option = "" 9 | } 10 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/questions/QuestionsShow__LinkedTarget.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | title: string, 4 | } 5 | 6 | let decode = json => { 7 | open Json.Decode 8 | { 9 | id: json |> field("id", string), 10 | title: json |> field("title", string), 11 | } 12 | } 13 | 14 | let id = t => t.id 15 | 16 | let title = t => t.title 17 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CourseExports__Tag.res: -------------------------------------------------------------------------------- 1 | type id = string 2 | 3 | type t = { 4 | id: id, 5 | name: string, 6 | } 7 | 8 | let id = t => t.id 9 | let name = t => t.name 10 | 11 | let decode = json => { 12 | open Json.Decode 13 | { 14 | id: json |> field("id", string), 15 | name: json |> field("name", string), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/CurriculumEditor__EvaluationCriteria.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: string, 3 | name: string, 4 | } 5 | 6 | let name = t => t.name 7 | 8 | let id = t => t.id 9 | 10 | let decode = json => { 11 | open Json.Decode 12 | { 13 | name: json |> field("name", string), 14 | id: json |> field("id", string), 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/expected/ident.res.txt: -------------------------------------------------------------------------------- 1 | module type BT = BTree 2 | module type BT = MultiCore.BTree 3 | module type BT = Std.MultiCore.BTree 4 | module type BT = ((BTree)[@attr ]) 5 | module type BT = ((MultiCore.BTree)[@attr ][@attr2 ]) 6 | module type BT = ((Std.MultiCore.BTree)[@attr ][@attr2 ][@attr3 ]) 7 | module type list = list 8 | module type t = s -------------------------------------------------------------------------------- /tests/parsing/recovery/typeDef/expected/typeParams.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/typeDef/typeParams.res:1:10-13 4 | 5 | 1 │ type node('a) = { 6 | 2 │ _value: Js.Nullable.value<'a> 7 | 3 │ } 8 | 9 | Type parameters require angle brackets: 10 | node<'a> 11 | 12 | type nonrec 'a node = { 13 | _value: 'a Js.Nullable.value } -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/packages/PfIcon.res: -------------------------------------------------------------------------------- 1 | @module("./iconFirst") 2 | external transformIcons: unit => unit = "transformIcons" 3 | 4 | @react.component 5 | let make = (~className) => { 6 | React.useEffect1(() => { 7 | transformIcons() 8 | None 9 | }, [className]) 10 | 11 | } 12 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_FormData.resi: -------------------------------------------------------------------------------- 1 | let add: (Warp_Types_Client.t<'a>, string, string) => Warp_Types_Client.t<'a> 2 | 3 | let set: (Warp_Types_Client.t<'a>, list<(string, string)>) => Warp_Types_Client.t<'a> 4 | 5 | let remove: (Warp_Types_Client.t<'a>, string) => Warp_Types_Client.t<'a> 6 | 7 | let setJson: (Warp_Types_Client.t<'a>, string) => Warp_Types_Client.t<'a> 8 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/expected/emptyInlineRecord.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/typeDef/emptyInlineRecord.res:3:10-11 4 | 5 | 1 │ type node<'a> = 6 | 2 │ | Nil 7 | 3 │ | Node({}) 8 | 4 │ 9 | 10 | An inline record declaration needs at least one field 11 | 12 | type nonrec 'a node = 13 | | Nil 14 | | Node of { 15 | } -------------------------------------------------------------------------------- /tests/printer/modExpr/expected/structure.res.txt: -------------------------------------------------------------------------------- 1 | module StringArray = { 2 | type t = array 3 | 4 | let empty = [] 5 | } 6 | 7 | module Empty = {} 8 | 9 | module Empty = { 10 | // TODO: convince management to implement this 11 | } 12 | 13 | module Empty = {/* test */} 14 | 15 | module EmptyModule = { 16 | /* TODO: management on vacation */ 17 | } 18 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/courses/CoursesStudents__Teams.res: -------------------------------------------------------------------------------- 1 | type t = 2 | | Unloaded 3 | | PartiallyLoaded(array, string) 4 | | FullyLoaded(array) 5 | 6 | let toArray = t => 7 | switch t { 8 | | Unloaded => [] 9 | | PartiallyLoaded(teams, _) => teams 10 | | FullyLoaded(teams) => teams 11 | } 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/try.res.txt: -------------------------------------------------------------------------------- 1 | ;;try ((let x = 1 in let y = 2 in dangerousCall (x + y))[@ns.braces ]) 2 | with | Foo -> Js.log {js|catched Foo|js} 3 | | Exit -> Js.log {js|catched exit|js} 4 | ;;try myDangerousFn () with | Foo -> Js.log {js|catched Foo|js}[@@attr ] 5 | let x = ((let y = 1 in try ((apply y)[@ns.braces ]) with | _ -> 2) 6 | [@ns.braces ]) -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/unit.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = unit 2 | type nonrec t = unit -> unit 3 | type nonrec t = unit -> unit -> unit 4 | type nonrec t = unit -> unit 5 | let f (f : unit -> unit) = f () 6 | let f (f : unit -> unit) = f () 7 | let f (f : unit -> unit -> unit) = f () () 8 | external svg : unit -> React.element = "svg" 9 | external thing : unit -> unit = "svg" -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__BeforeUnloadEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.beforeUnloadEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "BeforeUnloadEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "BeforeUnloadEvent" 9 | 10 | @get external returnValue: t => string = "" 11 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__ClipboardEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.clipboardEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "ClipboardEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "ClipboardEvent" 9 | 10 | @get external clipboardData: t => Dom.dataTransfer = "" 11 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__WebGlContextEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.webGlContextEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "WebGLContextEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "WebGLContextEvent" 9 | 10 | @get external statusMessage: t => string = "" 11 | -------------------------------------------------------------------------------- /tests/idempotency/reason-react-hackernews/link.res: -------------------------------------------------------------------------------- 1 | let handleClick = (href, event) => 2 | if !ReactEvent.Mouse.defaultPrevented(event) { 3 | ReactEvent.Mouse.preventDefault(event) 4 | ReasonReact.Router.push(href) 5 | } 6 | @react.component 7 | let make = (~href, ~className="", ~children) => 8 | handleClick(href, event)}> children 9 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/recursiveModules.res.txt: -------------------------------------------------------------------------------- 1 | module rec A:Map = struct let m = 2 end and B:Set = struct let s = 1 end 2 | module rec A:Map = struct let m = 2 end[@@onFirstBinding ] 3 | and B:Set = struct let s = 1 end[@@onSecondBinding ] 4 | module rec A:Map = struct let m = 2 end[@@onFirstBindingOfNext ] 5 | and B:Set = struct let s = 1 end[@@onSecondBindingOfNext ] -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__PageTransitionEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.pageTransitionEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "PageTransitionEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "PageTransitionEvent" 9 | 10 | @get external persisted: t => bool = "" 11 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/try.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/try.res:2:37-38 4 | 5 | 1 ┆ let parsedPayload = 6 | 2 ┆ try (Js.Json.parseExn(response)) { 7 | 3 ┆ | _ => Js.Json.null 8 | 4 ┆ } 9 | 10 | Did you forget a `catch` here? 11 | 12 | let parsedPayload = try Js.Json.parseExn response with | _ -> Js.Json.null -------------------------------------------------------------------------------- /tests/parsing/grammar/modtype/expected/typeof.res.txt: -------------------------------------------------------------------------------- 1 | module type MyHash = 2 | sig 3 | include module type of struct include Hashtbl end 4 | val replace : ('a, 'b) t -> 'a -> 'b -> unit 5 | end 6 | module type MyHash = 7 | sig 8 | include ((module type of struct include Hashtbl end)[@onModuleTypeOf ]) 9 | val replace : ('a, 'b) t -> 'a -> 'b -> unit 10 | end -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/modDecl.res: -------------------------------------------------------------------------------- 1 | module type Signature = { 2 | module Tree: {let x: int} 3 | 4 | module Functor: () => {let x: int} 5 | module Functor: Tree => Map => {let x: int} 6 | module Functor: (_ : Foo, _ : Bar) => {let x: int} 7 | @attr 8 | module Functor: (_ : Foo, _ : Bar) => {let x: int} 9 | 10 | @attr 11 | module Tree: {let x: int} 12 | } 13 | -------------------------------------------------------------------------------- /tests/conversion/reason/singleLineComments.res: -------------------------------------------------------------------------------- 1 | // This is the implementation of the _app.js file 2 | 3 | // Resources: 4 | // -------------- 5 | // Really good article on state persistence within layouts: 6 | // https://adamwathan.me/2019/10/17/persistent-layout-patterns-in-nextjs/ 7 | 8 | /* 9 | a 10 | 11 | */ 12 | 13 | /* 14 | a 15 | 16 | */ 17 | let x = 1 18 | // here 19 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/questions/QuestionsShow__Target.res: -------------------------------------------------------------------------------- 1 | type t = { 2 | id: option, 3 | title: string, 4 | } 5 | 6 | let id = t => t.id 7 | let title = t => t.title 8 | 9 | let decode = json => { 10 | open Json.Decode 11 | { 12 | id: json |> field("id", nullable(string)) |> Js.Null.toOption, 13 | title: json |> field("title", string), 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/argument.res: -------------------------------------------------------------------------------- 1 | let foo = (~a) => a(. ()) +. 1. 2 | let a = (. ()) => 2 3 | let bar = foo(~a) 4 | let comparisonResult = compare(. currentNode.value, ~targetValue) 5 | callback(. firstNode, ~y) 6 | 7 | document.createElementWithOptions(. "div", elementProps(~onClick=_ => 8 | Js.log("hello world") 9 | )) 10 | 11 | 12 | resolve(.) 13 | resolve(. ()) 14 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/apply.res.txt: -------------------------------------------------------------------------------- 1 | ;;foo (fun _ -> bla) blaz 2 | ;;foo (fun _ -> bla) blaz 3 | ;;foo ((fun _ -> bla)[@bs ]) blaz 4 | ;;foo (fun _ -> bla) (fun _ -> blaz) 5 | ;;List.map (fun x -> x + 1) myList 6 | ;;List.reduce (fun acc -> fun curr -> acc + curr) 0 myList 7 | let unitUncurried = ((apply ())[@bs ]) 8 | ;;call ~a:(((((a)[@ns.namedArgLoc ]) : int))[@ns.namedArgLoc ]) -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/expected/if.res.txt: -------------------------------------------------------------------------------- 1 | ;;if foo then true else false 2 | ;;if foo = 2 then let bar = 1 in let foo = 2 in bar + foo 3 | let ifThenElse = if foo then lala else doStuff x y z 4 | let ifElseIfThen = 5 | if foo = bar 6 | then f () 7 | else if foo = bar2 then f1 () else if foo = bar3 then f2 () else f3 () 8 | let x = (if true then 1 else 2) + (if false then 2 else 3) -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/bsObject.res: -------------------------------------------------------------------------------- 1 | type t = {"age": int} 2 | type t = {"age": int,} // trailing comma 3 | type t = {"age": int, "name": string} 4 | type t = {"age": int, "name": string,} // trailing comma 5 | 6 | type t = { 7 | @attr 8 | "age": int, 9 | @attr2 10 | "name": @onTypeString string, 11 | } 12 | 13 | type t = {.} 14 | type t = private {.} 15 | type t = {..} 16 | -------------------------------------------------------------------------------- /tests/printer/typexpr/any.res: -------------------------------------------------------------------------------- 1 | type t = _ 2 | type t = node<_> 3 | 4 | type t = {name: _} 5 | type t = {name: @attr _} 6 | 7 | type t = Plant(_) 8 | type t = Plant(@attr _) 9 | 10 | type t = (_, _) => unit 11 | type t = (@attr _, @attr _) => unit 12 | 13 | let x: _ = () 14 | let x: @attr _ = () 15 | 16 | external foo: _ = "foo_c_binding" 17 | external foo: @attr _ = "foo_c_binding" 18 | -------------------------------------------------------------------------------- /tests/printer/typexpr/expected/polyTyp.res.txt: -------------------------------------------------------------------------------- 1 | external getLogger: unit => { 2 | "log": 'a => unit, 3 | "log2": 'a. int => int, 4 | "log3": 'a 'b. ('a, 'b) => int, 5 | } = "./src/logger.mock.js" 6 | 7 | // polytype in label_declaration doesn't have attributes 8 | type reducer<'state> = { 9 | state: @attr 'state, 10 | send: 'action. @attr ('state, 'action) => 'action, 11 | } 12 | -------------------------------------------------------------------------------- /tests/printer/typexpr/polyTyp.res: -------------------------------------------------------------------------------- 1 | external getLogger: 2 | unit => { 3 | "log": 'a => unit, 4 | "log2": 'a. int => int, 5 | "log3": 'a 'b. ('a, 'b) => int 6 | } = 7 | "./src/logger.mock.js" 8 | 9 | // polytype in label_declaration doesn't have attributes 10 | type reducer<'state> = { 11 | state: @attr 'state, 12 | send: 'action. @attr ('state, 'action) => 'action 13 | } 14 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__RelatedEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.relatedEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "RelatedEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "RelatedEvent" 9 | 10 | @get @return(nullable) external relatedTarget: t => option = "" 11 | -------------------------------------------------------------------------------- /tests/idempotency/covid-19charts.com/src/Window.res: -------------------------------------------------------------------------------- 1 | type location = { 2 | search: string, 3 | href: string, 4 | } 5 | type locationState 6 | 7 | type history = {replaceState: (. locationState, string, string) => unit} 8 | 9 | type rec window = { 10 | history: history, 11 | location: location, 12 | mutable global: window, 13 | } 14 | 15 | @val external window: window = "window" 16 | -------------------------------------------------------------------------------- /tests/idempotency/mareo/Director.resi: -------------------------------------------------------------------------------- 1 | /* Initiates the main game loop */ 2 | let update_loop: ( 3 | Dom_html.canvasElement, 4 | (Object.collidable, list), 5 | (float, float), 6 | ) => unit 7 | 8 | /* Keydown event handler function */ 9 | let keydown: Dom.keyboardEvent => bool 10 | 11 | /* Keyup event handler function */ 12 | let keyup: Dom.keyboardEvent => bool 13 | -------------------------------------------------------------------------------- /tests/parsing/grammar/typexpr/expected/bsObject.res.txt: -------------------------------------------------------------------------------- 1 | type nonrec t = < age: int > 2 | type nonrec t = < age: int > 3 | type nonrec t = < age: int ;name: string > 4 | type nonrec t = < age: int ;name: string > 5 | type nonrec t = 6 | < age: int [@attr ] ;name: ((string)[@onTypeString ]) [@attr2 ] > 7 | type nonrec t = < > 8 | type nonrec t = private < > 9 | type nonrec t = < .. > -------------------------------------------------------------------------------- /tests/printer/expr/expected/jsObjectAccess.res.txt: -------------------------------------------------------------------------------- 1 | let x = address["street"] 2 | let x = address["street"]["number"] 3 | let x = @attr address["street"] 4 | 5 | longEqualityExpression["someRecordField"] == wowThisDoesHaveToBePrettyLong["someRecordField"] && 6 | longEqualityExpression["someRecordField"] == wowThisDoesHaveToBePrettyLong["someRecordField"] 7 | 8 | let component = props["Component"] 9 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/singleLineComments.res.txt: -------------------------------------------------------------------------------- 1 | // This is the implementation of the _app.js file 2 | 3 | // Resources: 4 | // -------------- 5 | // Really good article on state persistence within layouts: 6 | // https://adamwathan.me/2019/10/17/persistent-layout-patterns-in-nextjs/ 7 | 8 | /* 9 | a 10 | 11 | */ 12 | 13 | /* 14 | a 15 | 16 | */ 17 | let x = 1 18 | // here 19 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__DocumentFragment.res: -------------------------------------------------------------------------------- 1 | type t = Dom.documentFragment 2 | 3 | include Webapi__Dom__Node.Impl({ 4 | type t = t 5 | }) 6 | include Webapi__Dom__EventTarget.Impl({ 7 | type t = t 8 | }) 9 | include Webapi__Dom__NonElementParentNode.Impl({ 10 | type t = t 11 | }) 12 | include Webapi__Dom__ParentNode.Impl({ 13 | type t = t 14 | }) 15 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__DomStringMap__test.res: -------------------------------------------------------------------------------- 1 | open Webapi.Dom 2 | open Webapi.Dom.DomStringMap 3 | 4 | let dataset = 5 | document |> Document.createElement("div") |> Element.unsafeAsHtmlElement |> HtmlElement.dataset 6 | 7 | let () = set("fooKey", "barValue", dataset) 8 | let _ = get("fooKey", dataset) 9 | let () = unsafeDeleteKey("fooKey", dataset) 10 | -------------------------------------------------------------------------------- /tests/parsing/errors/typexpr/arrow.res: -------------------------------------------------------------------------------- 1 | // notice usage of -> instead of => 2 | external add_nat: nat -> int = "add_nat_bytecode" 3 | 4 | module Error2 = { 5 | type observation ={ 6 | observed: int, 7 | onStep: (~currentValue ) => unit 8 | } 9 | } 10 | 11 | module Error3 = { 12 | type observation ={ 13 | observed: int, 14 | onStep: ~currentValue => unit 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/expected/letBinding.res.txt: -------------------------------------------------------------------------------- 1 | let a = 1 2 | let a = 1[@@onFirstBinding ] 3 | let a = 1[@@onFirstBinding ] 4 | and b = 2[@@onSecondBinding ] 5 | let f : type t. t foo = 6 | fun sideEffect -> 7 | ((let module M = struct exception E of t end in 8 | sideEffect (); (fun x -> M.E x)) 9 | [@ns.braces ]) 10 | let f : type t x u. (t * x * y) list = fun l -> f l -------------------------------------------------------------------------------- /tests/parsing/grammar/structure/letBinding.res: -------------------------------------------------------------------------------- 1 | let a = 1 2 | 3 | @onFirstBinding 4 | let a = 1 5 | 6 | @onFirstBinding 7 | let a = 1 8 | @onSecondBinding 9 | and b = 2 10 | 11 | // locally abstract types 12 | let f: type t. foo = (sideEffect) => { 13 | module M = { exception E(t) } 14 | sideEffect() 15 | x => M.E(x) 16 | } 17 | 18 | let f: type t x u. list<(t, x, y)> = (l) => f(l) 19 | -------------------------------------------------------------------------------- /tests/parsing/other/docComments.res: -------------------------------------------------------------------------------- 1 | /*** This is a module comment */ 2 | 3 | /*** This is another module comment */ 4 | 5 | /** This is a doc ✅ comment */ 6 | let z = 34 7 | 8 | @@ns.doc("And this is a ns.doc module annotation") 9 | 10 | @ns.doc("And this is a ns.doc ✅ annotation") 11 | let q = 11 12 | 13 | /** This 14 | * is a multi-line 15 | multiline doc comment 16 | */ 17 | type h = int -------------------------------------------------------------------------------- /tests/parsing/recovery/pattern/expected/constrained.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/pattern/constrained.res:2:17-4:1 4 | 5 | 1 │ switch x { 6 | 2 │ | (a : int => () 7 | 3 │ // note that this is not ideal: | (a: int => unit) => exprhole 8 | 4 │ } 9 | 5 │ 10 | 11 | Did you forget a `)` here? 12 | 13 | ;;match x with | (a : int -> unit) -> [%rescript.exprhole ] -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__NodeList.res: -------------------------------------------------------------------------------- 1 | type t = Dom.nodeList 2 | 3 | @val external toArray: t => array = "Array.prototype.slice.call" 4 | 5 | @bs.send.pipe(: t) external forEach: ((Dom.node, int) => unit) => unit = "" 6 | 7 | @get external length: t => int = "" 8 | 9 | @bs.send.pipe(: t) @return(nullable) external item: int => option = "" 10 | -------------------------------------------------------------------------------- /tests/idempotency/covid-19charts.com/src/DatePicker.res: -------------------------------------------------------------------------------- 1 | @module("react-datepicker") @react.component 2 | external make: ( 3 | ~selected: Js.Date.t, 4 | ~onChange: Js.Date.t => unit, 5 | ~customInput: React.element, 6 | ~selectsStart: bool=?, 7 | ~selectsEnd: bool=?, 8 | ~startDate: Js.Date.t=?, 9 | ~endDate: Js.Date.t=?, 10 | ~minDate: Js.Date.t=?, 11 | ) => React.element = "default" 12 | -------------------------------------------------------------------------------- /tests/idempotency/genType/src/Emitters.resi: -------------------------------------------------------------------------------- 1 | type t 2 | 3 | let initial: t 4 | 5 | let exportEarly: (~emitters: t, string) => t 6 | 7 | let requireEarly: (~emitters: t, string) => t 8 | 9 | let \"export": (~emitters: t, string) => t 10 | 11 | let \"import": (~emitters: t, string) => t 12 | 13 | let require: (~emitters: t, string) => t 14 | 15 | let toString: (~separator: string, t) => string 16 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/expected/external.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/structure/external.res:2:51 4 | 5 | 1 │ // missing JS value name 6 | 2 │ external setTimeout: (unit => unit, int) => float = 7 | 3 │ 8 | 9 | An external requires the name of the JS value you're referring to, like "setTimeout". 10 | 11 | external setTimeout : (unit -> unit) -> int -> float -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/modtype.res: -------------------------------------------------------------------------------- 1 | module type Signature = { 2 | module type Belt 3 | 4 | @onModTypeDecl 5 | module type Belt 6 | 7 | module type Belt = { 8 | module type Array 9 | module type List 10 | } 11 | 12 | @onModTypeDecl 13 | module type Belt = { 14 | module type Array 15 | module type List 16 | } 17 | } 18 | 19 | module type my_module_type = {} 20 | -------------------------------------------------------------------------------- /tests/parsing/recovery/typexpr/expected/typeConstructorArgs.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/recovery/typexpr/typeConstructorArgs.res:2:28-31 4 | 5 | 1 │ type node<'a> = { 6 | 2 │ _value: Js.Nullable.value('a) 7 | 3 │ } 8 | 4 │ 9 | 10 | Type parameters require angle brackets: 11 | Js.Nullable.value<'a> 12 | 13 | type nonrec 'a node = { 14 | _value: 'a Js.Nullable.value } -------------------------------------------------------------------------------- /tests/printer/expr/jsObjectAccess.res: -------------------------------------------------------------------------------- 1 | let x = address["street"] 2 | let x = address["street"]["number"] 3 | let x = @attr address["street"] 4 | 5 | longEqualityExpression["someRecordField"] == 6 | wowThisDoesHaveToBePrettyLong["someRecordField"] && 7 | longEqualityExpression["someRecordField"] == 8 | wowThisDoesHaveToBePrettyLong["someRecordField"] 9 | 10 | let component = props["Component"] 11 | -------------------------------------------------------------------------------- /tests/printer/typexpr/expected/any.res.txt: -------------------------------------------------------------------------------- 1 | type t = _ 2 | type t = node<_> 3 | 4 | type t = {name: _} 5 | type t = {name: @attr _} 6 | 7 | type t = Plant(_) 8 | type t = Plant(@attr _) 9 | 10 | type t = (_, _) => unit 11 | type t = (@attr _, @attr _) => unit 12 | 13 | let x: _ = () 14 | let x: @attr _ = () 15 | 16 | external foo: _ = "foo_c_binding" 17 | external foo: @attr _ = "foo_c_binding" 18 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__TrackEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.trackEvent 2 | type track /* TODO: VideoTrack or AudioTrack or TextTrack */ 3 | 4 | include Webapi__Dom__Event.Impl({ 5 | type t = t 6 | }) 7 | 8 | @new external make: string => t = "TrackEvent" 9 | @new external makeWithOptions: (string, {..}) => t = "TrackEvent" 10 | 11 | @get external track: t => track = "" 12 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp_Types_ResponseType.res: -------------------------------------------------------------------------------- 1 | type rec payload<'a> = 2 | | ArrayBufferResponse(option): payload< 3 | option, 4 | > 5 | | DocumentResponse(option): payload> 6 | | JSONResponse(option): payload> 7 | | TextResponse(option): payload> 8 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/try.res: -------------------------------------------------------------------------------- 1 | try { 2 | let x = 1 3 | let y = 2 4 | dangerousCall(x + y) 5 | } catch { 6 | | Foo => Js.log("catched Foo") 7 | | Exit => Js.log("catched exit") 8 | } 9 | 10 | @attr 11 | try myDangerousFn() catch { 12 | | Foo => Js.log("catched Foo") 13 | } 14 | 15 | let x = { 16 | let y = 1 17 | try { 18 | apply(y) 19 | } catch { 20 | | _ => 2 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/ppx/react/innerModule.res: -------------------------------------------------------------------------------- 1 | @@jsxConfig({version: 3}) 2 | module Bar = { 3 | @react.component 4 | let make = (~a, ~b, _) => { 5 | Js.log("This function should be named `InnerModule.react$Bar`") 6 |
7 | } 8 | @react.component 9 | let component = (~a, ~b, _) => { 10 | Js.log("This function should be named `InnerModule.react$Bar$component`") 11 |
12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/schools/StudentsEditor__Types.res: -------------------------------------------------------------------------------- 1 | module Team = StudentsEditor__Team 2 | module Student = StudentsEditor__Student 3 | module Coach = StudentsEditor__Coach 4 | module StudentInfo = StudentsEditor__StudentInfo 5 | module Level = StudentsEditor__Level 6 | module Page = StudentsEditor__Page 7 | module Filter = StudentsEditor__Filter 8 | module SelectedStudent = StudentsEditor__SelectedStudent 9 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/PrismJs.res: -------------------------------------------------------------------------------- 1 | open Webapi.Dom 2 | 3 | @module("./prismjsWrapper") 4 | external highlightAllUnderJs: Dom.element => unit = "default" 5 | 6 | let highlightAllUnder = elementId => { 7 | let wrapperElement = document |> Document.getElementById(elementId) 8 | 9 | switch wrapperElement { 10 | | Some(element) => highlightAllUnderJs(element) 11 | | None => () 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/ScrollLock.res: -------------------------------------------------------------------------------- 1 | open Webapi.Dom 2 | 3 | let handleScrollLock = add => { 4 | let classes = add ? "overflow-hidden" : "" 5 | 6 | let body = document |> Document.getElementsByTagName("body") |> HtmlCollection.toArray 7 | 8 | body[0]->Element.setClassName(classes) 9 | } 10 | let activate = () => handleScrollLock(true) 11 | let deactivate = () => handleScrollLock(false) 12 | -------------------------------------------------------------------------------- /tests/parsing/errors/structure/expected/gh16A.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/structure/gh16A.res:6:1 4 | 5 | 4 │ }) 6 | 5 │ } 7 | 6 │ ) 8 | 7 │ Js.log("test"); // Is omitted from the compiled JS 9 | 8 │ 10 | 11 | I'm not sure what to parse here when looking at ")". 12 | 13 | module C = struct module T = (Fun)(struct ;;foo (a + c) (b + d) end) end 14 | ;;Js.log {js|test|js} -------------------------------------------------------------------------------- /tests/printer/pattern/expected/list.res.txt: -------------------------------------------------------------------------------- 1 | let list{} = 1 2 | let list{1} = 1 3 | let list{1, 2} = 1 4 | let list{1, 2, 3} = 1 5 | let list{1, 2, ...tail} = 1 6 | 7 | let list{aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc} = 1 8 | let list{ 9 | aaaaaaaaaaaaaaaaaaaaaaaaaa, 10 | bbbbbbbbbbbbbbbbbbbbbbbbbb, 11 | cccccccccccccccccccccccccc, 12 | ...tail, 13 | } = 1 14 | -------------------------------------------------------------------------------- /tests/printer/structure/expected/extension.res.txt: -------------------------------------------------------------------------------- 1 | %%raw("__eval__gc()") 2 | 3 | @attr 4 | %%raw("__eval__gc()") 5 | 6 | @attrStructureLvl @attrStructureLvl2 @attrStructureLvl3 7 | %%raw("__eval__gc()") 8 | 9 | @attrStructureLvl @attrStructureLvl2 @attrStructureLvl3 @attrStructureLvl4 @attrStructureLvl5 10 | %%raw("__eval__gc()") 11 | 12 | %%private(@module("./logo.svg") external logo: string = "default") 13 | -------------------------------------------------------------------------------- /tests/printer/structure/extension.res: -------------------------------------------------------------------------------- 1 | %%raw("__eval__gc()") 2 | 3 | @attr 4 | %%raw("__eval__gc()") 5 | 6 | @attrStructureLvl @attrStructureLvl2 @attrStructureLvl3 7 | %%raw("__eval__gc()") 8 | 9 | @attrStructureLvl @attrStructureLvl2 @attrStructureLvl3 @attrStructureLvl4 @attrStructureLvl5 10 | %%raw("__eval__gc()") 11 | 12 | %%private( 13 | @module("./logo.svg") external logo: string = "default" 14 | ) 15 | -------------------------------------------------------------------------------- /src/res_driver_ml_parser.mli: -------------------------------------------------------------------------------- 1 | (* This module represents a general interface to parse marshalled reason ast *) 2 | 3 | (* extracts comments and the original string data from an ocaml file *) 4 | val extractOcamlConcreteSyntax : 5 | string -> (string * Location.t) list * Res_comment.t list 6 | [@@live] 7 | 8 | val parsingEngine : unit Res_driver.parsingEngine 9 | 10 | val printEngine : Res_driver.printEngine 11 | -------------------------------------------------------------------------------- /src/res_io.ml: -------------------------------------------------------------------------------- 1 | let readFile ~filename = 2 | let chan = open_in_bin filename in 3 | let content = 4 | try really_input_string chan (in_channel_length chan) 5 | with End_of_file -> "" 6 | in 7 | close_in_noerr chan; 8 | content 9 | 10 | let writeFile ~filename ~contents:txt = 11 | let chan = open_out_bin filename in 12 | output_string chan txt; 13 | close_out chan 14 | [@@raises Sys_error] 15 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__MutationObserver.res: -------------------------------------------------------------------------------- 1 | type t = Dom.mutationObserver 2 | 3 | @new external make: ((array, t) => unit) => t = "MutationObserver" 4 | 5 | @bs.send.pipe(: t) external observe: (Dom.node_like<'a>, {..}) => unit = "" 6 | @bs.send.pipe(: t) external disconnect: unit = "" 7 | @bs.send.pipe(: t) external takeRecords: array = "" 8 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/questions/QuestionsShow__Types.res: -------------------------------------------------------------------------------- 1 | module Answer = QuestionsShow__Answer 2 | module Comment = QuestionsShow__Comment 3 | module Question = QuestionsShow__Question 4 | module User = QuestionsShow__User 5 | module Like = QuestionsShow__Like 6 | module Target = QuestionsShow__Target 7 | module LinkedTarget = QuestionsShow__LinkedTarget 8 | module QuestionSuggestion = QuestionsShow__QuestionSuggestion 9 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/expected/parenthesized.res.txt: -------------------------------------------------------------------------------- 1 | module A = ParenthesizedModule 2 | module A = DoubleParenthesizedModule 3 | module A = ((ParenthesizedModule)[@attr ]) 4 | module F(A:X) = A 5 | module A = struct let a = 1 end 6 | module A = (ModApply)(MyMod) 7 | module A : X = A 8 | include ParenthesizedModule 9 | include ((ParenthesizedModule)[@attr ]) 10 | module A = ((ParenthesizedModule)[@attr2 ][@attr ]) -------------------------------------------------------------------------------- /tests/parsing/recovery/expression/list.res: -------------------------------------------------------------------------------- 1 | // ocaml style list with array syntax 2 | let flags = reasonFormat ? { 3 | let parts = Utils.split_on_char(' ', flags) 4 | let rec loop = (items) => { 5 | switch(items) { 6 | | ["-pp", _ppFlag, ...rest] => loop(rest) 7 | | [x, ...rest] => [x, ...loop(rest)] 8 | | [] => [] 9 | } 10 | }; 11 | loop(parts) |> String.concat(" ") 12 | } : flags 13 | -------------------------------------------------------------------------------- /tests/printer/typeDef/exoticIdent.res: -------------------------------------------------------------------------------- 1 | type \"type" = User.\"type" = { 2 | \"module": \"type", 3 | \"let": \"module" 4 | } 5 | 6 | type \"Color" = 7 | | Red(\"let", \"module", \"type") 8 | | Blue(\"let", \"module", \"type"): \"Color"<\"let", \"SuperType"> 9 | 10 | type \"type"<'\"😱 gadt", '\"😻"> 11 | constraint '\"type" = \"let" 12 | 13 | type \"type"<'\"😆SuperIdent"> += Blue(\"type", \"ExtremeType") 14 | -------------------------------------------------------------------------------- /tests/parsing/grammar/expressions/uncurried.res: -------------------------------------------------------------------------------- 1 | let f = (. a, b) => a + b 2 | let f = (. a, . b) => a + b 3 | let f = (. a, b, . c, d) => a + b + c + d 4 | 5 | let f = @attr (. a) => @attr2 b => @attr3 (. c) => @attr4 d => () 6 | let f = (. @attr a, @attr2 b, . @attr3 c, @attr4 d) => () 7 | let f = (. (@attr a), (@attr2 b), . (@attr3 c), (@attr4 d)) => () 8 | 9 | add(. 1, 2) 10 | add(. 2, 3, 4, . 5, 6, 7, . 8, 9, 10); 11 | -------------------------------------------------------------------------------- /tests/printer/expr/nestedCallbacks.res: -------------------------------------------------------------------------------- 1 | let foo = () => 2 | bar(x => 3 | bar(x => 4 | bar(x => 5 | bar(x => 6 | bar(x => 7 | bar(x => 8 | bar(x => 9 | bar(x => 10 | bar(x => 11 | bar(x => 12 | bar(x => 13 | bar(x => 14 | bar(x => 15 | bar(x => 16 | bar(x => 17 | bar(x => 18 | bar(x => 19 | bar(x => 20 | bar(x => 21 | bar(x => 22 | bar(x => 23 | bar(x => x) 24 | ))))))))))))))))))))) -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__CloseEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.closeEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "CloseEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "CloseEvent" 9 | 10 | @get external wasClean: t => bool = "" 11 | @get external code: t => int = "" 12 | @get external reason: t => string = "" 13 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__TimeEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.timeEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "TimeEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "TimeEvent" 9 | 10 | @get external detail: t => int = "" 11 | @get external view: t => Dom.window = "" /* technically returns a `WindowProxy` */ 12 | -------------------------------------------------------------------------------- /tests/idempotency/nook-exchange/Link.res: -------------------------------------------------------------------------------- 1 | @react.component 2 | let make = (~path, ~children, ~className=?, ~onClick=?, ()) => 3 | { 6 | switch onClick { 7 | | Some(onClick) => onClick() 8 | | None => () 9 | } 10 | ReasonReactRouter.push(path) 11 | ReactEvent.Mouse.preventDefault(e) 12 | }} 13 | ?className> 14 | children 15 | 16 | -------------------------------------------------------------------------------- /tests/idempotency/pupilfirst/shared/EmailUtils.res: -------------------------------------------------------------------------------- 1 | let regularExpression = %re( 2 | "/^(([^<>()\\[\\]\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\"]+)*)|(\".+\"))@(([^<>()[\\]\\.,;:\\s@\"]+\\.)+[^<>()[\\]\\.,;:\\s@\"]{2,})$/i" 3 | ) 4 | 5 | let isInvalid = (allowBlank, email) => 6 | if email |> String.trim |> String.length > 0 { 7 | !(email |> Js.Re.test_(regularExpression)) 8 | } else { 9 | !allowBlank 10 | } 11 | -------------------------------------------------------------------------------- /tests/parsing/errors/expressions/expected/arrow.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/expressions/arrow.res:1:52 4 | 5 | 1 │ Object.keys(providers).reduce((elements, providerId] => { 6 | 2 │ let x = 1 7 | 3 │ let b = 2 8 | 9 | Did you forget a `,` here? 10 | 11 | ;;(Object.keys providers).reduce 12 | (fun elements -> 13 | fun providerId -> ((let x = 1 in let b = 2 in x + b)[@ns.braces ])) -------------------------------------------------------------------------------- /tests/parsing/errors/typexpr/expected/garbage.res.txt: -------------------------------------------------------------------------------- 1 | 2 | Syntax error! 3 | tests/parsing/errors/typexpr/garbage.res:2:28 4 | 5 | 1 │ @bs.module("moduleName") 6 | 2 │ external printName: (~name:?, unit) => unit = "printName" 7 | 3 │ 8 | 9 | I'm not sure what to parse here when looking at "?". 10 | 11 | external printName : name:((unit)[@ns.namedArgLoc ]) -> unit = "printName" 12 | [@@bs.module {js|moduleName|js}] -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/modDecl.res.txt: -------------------------------------------------------------------------------- 1 | module type Signature = 2 | sig 3 | module Tree : sig val x : int end 4 | module Functor : functor () -> sig val x : int end 5 | module Functor : Tree -> Map -> sig val x : int end 6 | module Functor : Foo -> Bar -> sig val x : int end 7 | module Functor : Foo -> Bar -> sig val x : int end[@@attr ] 8 | module Tree : sig val x : int end[@@attr ] 9 | end -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/modtype.res.txt: -------------------------------------------------------------------------------- 1 | module type Signature = 2 | sig 3 | module type Belt 4 | module type Belt[@@onModTypeDecl ] 5 | module type Belt = sig module type Array module type List end 6 | module type Belt = sig module type Array module type List end[@@onModTypeDecl 7 | ] 8 | end 9 | module type my_module_type = sig end -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/external.res: -------------------------------------------------------------------------------- 1 | module type Signature = { 2 | type t 3 | 4 | @bs.send 5 | external linkProgram: (t, ~program: webGlProgram) => unit = "linkProgram" 6 | 7 | external add_nat: (nat, int, int) => int = "add_nat_bytecode" 8 | 9 | 10 | // with semicolon 11 | external svg: () => React.element = "svg"; 12 | // without semicolon 13 | external svg: () => React.element = "svg" 14 | } 15 | -------------------------------------------------------------------------------- /tests/printer/other/string.res: -------------------------------------------------------------------------------- 1 | let s = "a string with \b \n \r \t abcdef" 2 | 3 | let s = "🚀 🤭 🔥 😀 with emojis 😅 👌 test 👀" 4 | 5 | let s = "a \"string inside\" a string" 6 | 7 | let s = "a double escaped \\ test" 8 | 9 | let s = "what happens here \\n" 10 | 11 | let s = "\0 \xA0" 12 | 13 | let s = "unknown escape \m111 as passed through" 14 | 15 | let heart = "\u2665" 16 | 17 | let smile = "emoji: \u{1F600}" 18 | -------------------------------------------------------------------------------- /tests/printer/typeDef/expected/exoticIdent.res.txt: -------------------------------------------------------------------------------- 1 | type \"type" = User.\"type" = { 2 | \"module": \"type", 3 | \"let": \"module", 4 | } 5 | 6 | type \"Color" = 7 | | Red(\"let", \"module", \"type") 8 | | Blue(\"let", \"module", \"type"): \"Color"<\"let", \"SuperType"> 9 | 10 | type \"type"<'\"😱 gadt", '\"😻"> constraint '\"type" = \"let" 11 | 12 | type \"type"<'\"😆SuperIdent"> += Blue(\"type", \"ExtremeType") 13 | -------------------------------------------------------------------------------- /tests/conversion/reason/gentype.res: -------------------------------------------------------------------------------- 1 | module M: { 2 | @genType @after 3 | type t 4 | 5 | @genType @after 6 | let x: int 7 | 8 | @foo 9 | type e = .. 10 | } = { 11 | type t 12 | let x = 34 13 | type e = .. 14 | } 15 | 16 | module type MT = { 17 | @genType @after 18 | type t 19 | 20 | @genType @after 21 | let x: int 22 | 23 | @foo 24 | type e = .. 25 | } 26 | 27 | @genType("ddd") 28 | let x = 42 29 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__CompositionEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.compositionEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | include Webapi__Dom__UiEvent.Impl({ 7 | type t = t 8 | }) 9 | 10 | @new external make: string => t = "CompositionEvent" 11 | @new external makeWithOptions: (string, {..}) => t = "CompositionEvent" 12 | 13 | @get external data: t => string = "" 14 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__HtmlCollection.res: -------------------------------------------------------------------------------- 1 | type t = Dom.htmlCollection 2 | 3 | @val @scope(("Array", "prototype", "slice")) external toArray: t => array = "call" 4 | 5 | @get external length: t => int = "" 6 | @bs.send.pipe(: t) @return(nullable) external item: int => option = "" 7 | @bs.send.pipe(: t) @return(nullable) external namedItem: string => option = "" 8 | -------------------------------------------------------------------------------- /tests/idempotency/bs-webapi/src/Webapi/Webapi__Dom/Webapi__Dom__IdbVersionChangeEvent.res: -------------------------------------------------------------------------------- 1 | type t = Dom.idbVersionChangeEvent 2 | 3 | include Webapi__Dom__Event.Impl({ 4 | type t = t 5 | }) 6 | 7 | @new external make: string => t = "IDBVersionChangeEvent" 8 | @new external makeWithOptions: (string, {..}) => t = "IDBVersionChangeEvent" 9 | 10 | @get external oldVersion: t => int = "" 11 | @get external newVersion: t => int = "" 12 | -------------------------------------------------------------------------------- /tests/idempotency/warp/Warp.resi: -------------------------------------------------------------------------------- 1 | module Client = Warp_Client 2 | module Header = Warp_Header 3 | module Method = Warp_Method 4 | module QueryString = Warp_QueryString 5 | module FormData = Warp_FormData 6 | module ResponseType = Warp_ResponseType 7 | module Types = Warp_Types 8 | module Event = Warp_Event 9 | module Settings = Warp_Settings 10 | 11 | let send: Types.Client.t> => option unit> 12 | -------------------------------------------------------------------------------- /tests/parsing/grammar/modexpr/parenthesized.res: -------------------------------------------------------------------------------- 1 | module A = (ParenthesizedModule) 2 | module A = ((DoubleParenthesizedModule)) 3 | module A = @attr (ParenthesizedModule) 4 | 5 | module F = ((A: X) => A) 6 | 7 | module A = ({ let a = 1 }) 8 | module A = (ModApply(MyMod)) 9 | module A = ((A: X)) 10 | 11 | include (ParenthesizedModule) 12 | include @attr (ParenthesizedModule) 13 | 14 | module A = @attr (@attr2 ParenthesizedModule) 15 | -------------------------------------------------------------------------------- /tests/parsing/grammar/signature/expected/external.res.txt: -------------------------------------------------------------------------------- 1 | module type Signature = 2 | sig 3 | type nonrec t 4 | external linkProgram : 5 | t -> program:((webGlProgram)[@ns.namedArgLoc ]) -> unit = "linkProgram" 6 | [@@bs.send ] 7 | external add_nat : nat -> int -> int -> int = "add_nat_bytecode" 8 | external svg : unit -> React.element = "svg" 9 | external svg : unit -> React.element = "svg" 10 | end -------------------------------------------------------------------------------- /tests/printer/structure/expected/recModules.res.txt: -------------------------------------------------------------------------------- 1 | module rec A: Map = { 2 | let m = 2 3 | } 4 | and B: Set = { 5 | let s = 1 6 | } 7 | 8 | @onFirstBinding 9 | module rec A: Map = { 10 | let m = 2 11 | } 12 | @onSecondBinding 13 | and B: Set = { 14 | let s = 1 15 | } 16 | 17 | @onFirstBindingOfNext 18 | module rec A: Map = { 19 | let m = 2 20 | } 21 | @onSecondBindingOfNext 22 | and B: Set = { 23 | let s = 1 24 | } 25 | -------------------------------------------------------------------------------- /tests/parsing/other/expected/docComments.res.txt: -------------------------------------------------------------------------------- 1 | [@@@ns.doc " This is a module comment "] 2 | [@@@ns.doc " This is another module comment "] 3 | let z = 34[@@ns.doc " This is a doc \226\156\133 comment "] 4 | [@@@ns.doc {js|And this is a ns.doc module annotation|js}] 5 | let q = 11[@@ns.doc {js|And this is a ns.doc ✅ annotation|js}] 6 | type nonrec h = int[@@ns.doc 7 | " This\n * is a multi-line\n multiline doc comment\n "] -------------------------------------------------------------------------------- /tests/printer/other/expected/string.res.txt: -------------------------------------------------------------------------------- 1 | let s = "a string with \b \n \r \t abcdef" 2 | 3 | let s = "🚀 🤭 🔥 😀 with emojis 😅 👌 test 👀" 4 | 5 | let s = "a \"string inside\" a string" 6 | 7 | let s = "a double escaped \\ test" 8 | 9 | let s = "what happens here \\n" 10 | 11 | let s = "\0 \xA0" 12 | 13 | let s = "unknown escape \m111 as passed through" 14 | 15 | let heart = "\u2665" 16 | 17 | let smile = "emoji: \u{1F600}" 18 | -------------------------------------------------------------------------------- /tests/printer/pattern/constraint.res: -------------------------------------------------------------------------------- 1 | switch thing { 2 | | Some((node: node)) => () 3 | | Some(node: Feature.node) => () 4 | | list{(child: node), ...rest} => () 5 | | list{child: node, ...rest} => () 6 | | (Some(_), Some((menuItem: Menu.item))) => () 7 | | (Some(_), Some(menuItem: Menu.item)) => () 8 | | SettingChanged(({fullName, value, _}: Nova.Setting.t)) => () 9 | | SettingChanged({fullName, value, _}: Nova.Setting.t) => () 10 | } 11 | -------------------------------------------------------------------------------- /tests/conversion/reason/expected/gentype.res.txt: -------------------------------------------------------------------------------- 1 | module M: { 2 | @genType @after 3 | type t 4 | 5 | @genType @after 6 | let x: int 7 | 8 | @foo 9 | type e = .. 10 | } = { 11 | type t 12 | let x = 34 13 | type e = .. 14 | } 15 | 16 | module type MT = { 17 | @genType @after 18 | type t 19 | 20 | @genType @after 21 | let x: int 22 | 23 | @foo 24 | type e = .. 25 | } 26 | 27 | @genType("ddd") 28 | let x = 42 29 | -------------------------------------------------------------------------------- /tests/parsing/errors/typeDef/inlineRecord.res: -------------------------------------------------------------------------------- 1 | type entity = 2 | | Director 3 | | Student({ 4 | name: string, 5 | reportCard: { 6 | passing: bool, 7 | score: int 8 | } 9 | }) 10 | 11 | type user = { 12 | name: string, 13 | address: { 14 | street: string, 15 | country: string, 16 | } 17 | } 18 | 19 | let make = (props: {handleClick: Click.t => unit, value: string}) => render(props) 20 | --------------------------------------------------------------------------------