Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#412): removed the empty object warning for lambda objects #415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Marat-Tim
Copy link
Contributor

It seems to be in the eo repository in the file https://github.com/objectionary/eo/blob/master/eo-parser/src/main/resources/org/eolang/parser/_funcs.xsl there is a problem with the atom function, as it checks that the nested one, not the current one, has the name lambda

@Marat-Tim
Copy link
Contributor Author

@yegor256

@yegor256
Copy link
Member

@h1alexbel please, review this one

Copy link
Member

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marat-Tim please check my comments

@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marat-Tim let's rename this pack to allows-lambda-object-in-atom.yaml

<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
<xsl:for-each select="/program/objects//o[not(@base) and not(o) and not(eo:atom(.))]">
<xsl:for-each select="/program/objects//o[not(@base) and not(o) and not(eo:atom(.)) and not(@name=$eo:lambda)]">
Copy link
Member

@h1alexbel h1alexbel Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marat-Tim we also should check that object with @name=$eo:lambda is placed inside the atom. Currently it is legal to have such XMIR (we need to complain instead):

<program>
  <objects>
       <o name="λ"/>
   </objects>
</program>

@name="λ" should be allowed only inside atom. The following XMIR should be warning-free:

<program>
  <objects>
      <o name="name">
         <o name="λ"/>
      </o>
   </objects>
</program>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants