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

App/Gui: Refactor expression completer and unit expressions #3062

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from

Conversation

realthunder
Copy link
Collaborator

@realthunder realthunder commented Feb 16, 2020

Forum thread https://forum.freecadweb.org/viewtopic.php?f=17&t=43412

The refactor are mostly in Gui/ExpressionCompleter.cpp file. The misleadingly huge change set is due to some minor change in expression scanner and parser source file, which resulted huge changes in generated code.

@vocx-fc
Copy link
Contributor

vocx-fc commented Feb 17, 2020

It seems the Travis tests fail because of the Spreadsheet unit tests. Maybe you can re-write these as well, or comment them temporarily, so that Travis finishes testing the rest of the code.

@realthunder
Copy link
Collaborator Author

That's strange. I ran the test several times to make sure it'll pass unchanged. I'll investigate.

@realthunder
Copy link
Collaborator Author

@vocx-fc Can you try build my branch and see if you have problem with the Spreadsheet test?

@wwmayer Can you shed some light on this? Anything special about the running test in Travis? I have built Python2 and 3 on both Linux and Window in three computer setup, all of them can pass the spreadsheet test.

@wwmayer
Copy link
Contributor

wwmayer commented Feb 17, 2020

Have you tried to run the command line version? When only testing with the GUI version then additional modules are loaded and things apparently seem to work while in cmd line version they fail.

@realthunder
Copy link
Collaborator Author

Yes, I tried command line version on all of my computers.

@vocx-fc
Copy link
Contributor

vocx-fc commented Feb 17, 2020

@realthunder

I fail to compile your branch. It errors very soon.

[  5%] Building CXX object src/Base/CMakeFiles/FreeCADBase.dir/QuantityPyImp.cpp.o
In file included from /opt/freecad-source-vocx/src/Base/Quantity.h:27:0,
                 from /opt/freecad-source-vocx/src/Base/QuantityPyImp.cpp:25:
/opt/freecad-source-vocx/src/Base/Unit.h:98:23: error: ‘vector’ in namespace ‘std’ does not name a template type
     static const std::vector<std::pair<Unit,const char*> > &unitTypes();
                       ^~~~~~
In file included from /opt/freecad-source-vocx/src/Base/QuantityPyImp.cpp:25:0:
/opt/freecad-source-vocx/src/Base/Quantity.h:160:23: error: ‘vector’ in namespace ‘std’ does not name a template type
     static const std::vector<UnitInfo> &unitInfo();
                       ^~~~~~

I see your branch is a bit old, based on 16b2b9a. I tried to rebase it onto master but I get conflicts.

CONFLICT (content): Merge conflict in src/Gui/ExpressionCompleter.h
Auto-merging src/Gui/ExpressionCompleter.cpp
error: Failed to merge in the changes.
Patch failed at 0004 Gui: refactor ExpressionCompleter

@realthunder
Copy link
Collaborator Author

I fail to compile your branch. It errors very soon.

Another strange issue, maybe they are related. How did you clone my branch? My initial submit of this PR had this build error. I force pushed the fix along with an upstream rebase. Maybe travis got stalled cache or something because of the force push? But then again, how did you get the non-existent revision?

Please check the header file src/Base/Unit.h. The fixed version shall include additional header .

@vocx-fc
Copy link
Contributor

vocx-fc commented Feb 17, 2020

I git add remote your branch as a remote in my system, and then git checkouted your branch. I have now git fetched again your repository, and it now seems the branch is updated (forced push). Now it seems to be based on a76bc63. I will try compiling again.

@realthunder
Copy link
Collaborator Author

realthunder commented Feb 17, 2020

Hmm... maybe it's github getting some cloud syncing problem. I don't know what did you see, but on my computer viewing this very PR, it shows my force push at 22 hours ago, and your first comment 17 hours ago. So, by right, you shouldn't be able to get the old revision, unless you have cloned my branch very soon after my PR submission?

@vocx-fc
Copy link
Contributor

vocx-fc commented Feb 17, 2020

I think what happened is that I added your repository earlier, around the time you made the pull request, but I had not git fetched the latest changes. So, I had fetched the reference to an old version of your branch.

@vocx-fc
Copy link
Contributor

vocx-fc commented Feb 18, 2020

I compiled successfully, opened FreeCAD, tested the Spreadsheet, and everything worked fine.

I ran the unit tests of Spreadsheet and these are some of the messages that I get. They appear on the terminal, but they don't make the tests fail.

bin/FreeCAD -t TestSpreadsheet

testAggregates (TestSpreadsheet.SpreadsheetCases)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet001.H6: Quantity::operator +=(): Unit mismatch in plus operation
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet001.H5: Quantity::operator -(): Unit mismatch in minus operation
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet001.H3: Quantity::operator >(): quantities need to have same unit to compare
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet001.H2: Quantity::operator <(): quantities need to have same unit to compare
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet001.H1: Quantity::operator +=(): Unit mismatch in plus operation
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet001.D1: Invalid number of entries: at least two required.
1e-07 <App> Document.cpp(3464): Failed to recompute Unnamed#Spreadsheet001: One or more cells failed contains errors.
Recompute failed! Please check report view.
Test all aggregate functions ... ok
testAlias (TestSpreadsheet.SpreadsheetCases)
Playing with aliases ... ok
testAmbiguousAlias (TestSpreadsheet.SpreadsheetCases)
Try to set the same alias twice (bug #2402) ... ok
testClearAlias (TestSpreadsheet.SpreadsheetCases)
This was causing a crash ... ok
testCrossDocumentLinks (TestSpreadsheet.SpreadsheetCases)
Expressions across files are not saved (bug #2442) ... ok
testFunctions (TestSpreadsheet.SpreadsheetCases)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C27: Units must be equal.
cath(7.0710678118654764mm; 5mm; 4)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C26: Units must be equal.
cath(5mm; 3)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C24: Units must be equal.
hypot(3mm; 4; 5)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C23: Units must be equal.
hypot(3mm; 4)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.D21: Exponent is not allowed to have a unit.
pow(7mm; 4mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C20: Units must be equal.
atan2(3mm; 3)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.B17: Unit must be empty.
tanh(0.5mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.B16: Unit must be empty.
cosh(0.5mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.B15: Unit must be empty.
sinh(0.5mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.B14: Unit must be empty.
atan(0.5mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.B13: Unit must be empty.
acos(0.5mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.B12: Unit must be empty.
asin(0.5mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C7: Unit must be empty.
log10(-3mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C6: Unit must be empty.
log(-3mm)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.C5: Unit must be empty.
exp(-3mm)
0.431293 <App> Document.cpp(3464): Failed to recompute Unnamed#Spreadsheet: One or more cells failed contains errors.
Recompute failed! Please check report view.
Test all built-in simple functions ... ok
testInsertRows (TestSpreadsheet.SpreadsheetCases)
Inserting rows -- check renaming of internal cells ... ok
testInvoluteGear (TestSpreadsheet.SpreadsheetCases)
Support of boolean or integer values ... ok
testIssue3128 (TestSpreadsheet.SpreadsheetCases)
Regression test for issue 3128; mod should work with arbitrary units for both arguments ... ok
testIssue3225 (TestSpreadsheet.SpreadsheetCases)
Inserting rows -- check renaming of internal cells ... ok
testIssue3363 (TestSpreadsheet.SpreadsheetCases)
Regression test for issue 3363; Nested conditionals statement fails with additional conditional statement in false-branch ... ok
testIssue3432 (TestSpreadsheet.SpreadsheetCases)
Regression test for issue 3432; numbers with units are ignored from aggregates ... ok
testMatrix (TestSpreadsheet.SpreadsheetCases)
<Spreadsheet> Cell.cpp(592): Unnamed#Spreadsheet.H2: Cannot invert singular matrix
G2 ^ -1
0.829919 <App> Document.cpp(3464): Failed to recompute Unnamed#Spreadsheet: One or more cells failed contains errors.
Recompute failed! Please check report view.
Test Matrix/Vector/Placement/Rotation operations ... ok
testNumbers (TestSpreadsheet.SpreadsheetCases)
Test different numbers ... ok
testPlacementName (TestSpreadsheet.SpreadsheetCases)
Object name is equal to property name (bug #2389) ... ok
testPrecedence (TestSpreadsheet.SpreadsheetCases)
Precedence -- test precedence for relational operators and conditional operator. ... ok
testRelationalOperators (TestSpreadsheet.SpreadsheetCases)
Test relational operators ... ok
testRemoveRows (TestSpreadsheet.SpreadsheetCases)
Removing rows -- check renaming of internal cells ... ok
testRenameAlias (TestSpreadsheet.SpreadsheetCases)
Test renaming of alias1 to alias2 in a spreadsheet ... ok
testRenameAlias2 (TestSpreadsheet.SpreadsheetCases)
Test renaming of alias1 to alias2 in a spreadsheet, when referenced from another object ... ok
testRenameAlias3 (TestSpreadsheet.SpreadsheetCases)
Test renaming of document object referenced from another object ... ok
testSetInvalidAlias (TestSpreadsheet.SpreadsheetCases)
Try to use a cell address as alias name ... ok
testSetInvalidAlias2 (TestSpreadsheet.SpreadsheetCases)
Try to use a unit (reserved word) as alias name ... ok
testSketcher (TestSpreadsheet.SpreadsheetCases)
Mixup of Label and Name (bug #2407) ... ok
testUnits (TestSpreadsheet.SpreadsheetCases)
Units -- test unit calculations. ... ok

----------------------------------------------------------------------
Ran 25 tests in 1.545s

OK
System exit

chennes
chennes previously approved these changes Nov 14, 2020
Copy link
Member

@chennes chennes left a comment

Choose a reason for hiding this comment

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

First, thanks and kudos to @realthunder for writing this -- I love the functionality, it makes expressions much faster to write and much less error prone. I also appreciate the "discoverability" that this feature adds to FreeCAD, allowing me to easily see what properties are available where. I've added a few very minor comments within the code. I cannot pretend to understand all of what I am reading here, I am still learning the FreeCAD codebase, and this is a pretty daunting change to look through! So my review is mostly that it compiles and runs, and works as intended, and I don't see anything too horrifying in the code. Well, seeing a union in modern C++ scares me a little... :) I know, that was there before...

@@ -130,7 +130,8 @@ const boost::any Property::getPathValue(const ObjectIdentifier &path) const

void Property::getPaths(std::vector<ObjectIdentifier> &paths) const
{
paths.emplace_back(getContainer(), getName());
(void)paths;
Copy link
Member

Choose a reason for hiding this comment

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

A comment about why getPaths does nothing would be nice - I don't understand why it's been disabled.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The reason is mentioned in 3b5388d commit message.

Copy link
Member

Choose a reason for hiding this comment

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

Hah, I was about to repeat myself here! Can you please add a short comment in the source code, so readers don't have to dig through git blame?

src/Mod/Spreadsheet/App/PropertySheet.cpp Show resolved Hide resolved
if(role == Qt::EditRole)
return QString::fromLatin1(".%1.").arg(
QString::fromLatin1(sobj->getNameInDocument()));
else if(role == Qt::UserRole && obj->getPropertyByName(sobj->getNameInDocument())) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be a good idea to give Qt::UserRole (and Qt::UserRole+1, which I think is also used later on) more descriptive names within this file, either via a locally-defined enumeration, or just some const ints.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair point. I'll change that later

Copy link
Contributor

@ezzieyguywuf ezzieyguywuf left a comment

Choose a reason for hiding this comment

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

Yikes! I started this review but never hit submit (months and months ago).

I'm going to go ahead and submit this - this review is incomplete but hopefully it can begin some good conversations

Comment on lines 131 to 158
void Property::getPaths(std::vector<ObjectIdentifier> &paths) const
{
paths.emplace_back(getContainer(), getName());
(void)paths;
// paths.emplace_back(getContainer(), getName());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this function is not being used any more - why not just remove altogether?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function is still used by some property to expose its sub-value to be accessed by the expression only. The property can choose to expose sub-value either through Python, which is also accessible by expression.

Comment on lines +623 to +614

// Unlike the above path (which provides units that are not available
// through python, the following paths provides the same value. They are no
// longer needed, because the expression completer will now dig into all
// python attributes.

// paths.push_back(ObjectIdentifier(*this)
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("Rotation"))
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("Axis"))
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("x")));
// paths.push_back(ObjectIdentifier(*this)
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("Rotation"))
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("Axis"))
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("y")));
// paths.push_back(ObjectIdentifier(*this)
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("Rotation"))
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("Axis"))
// << ObjectIdentifier::SimpleComponent(ObjectIdentifier::String("z")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than commenting this out, it should be deleted altogether.

Then, this could be a standalone commit, explaining in the commit message what you have here in your comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The commit 3b5388d that did the change mention the reason in its commit message. The modification here just provides some more detail with context.

@@ -69,6 +69,7 @@ AppExport std::string quote(const std::string &input, bool toPython=false);
_t(_t &&other) { *this = std::move(other); }\
_t &operator=(_t &&other)


Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this blank line added?

@@ -174,10 +183,13 @@ class AppExport ObjectIdentifier {
int begin=INT_MAX, int end=INT_MAX, int step=1);

static Component SimpleComponent(const char * _component);

static Component SimpleComponent(const String & _component);
static Component SimpleComponent(const String &_component);
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a trailing space on this line - it should be deleted.

static Component SimpleComponent(const String &_component); //<- the trailing space is here after the ;

Copy link
Contributor

@ezzieyguywuf ezzieyguywuf left a comment

Choose a reason for hiding this comment

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

I'll keep submitting my reviews as I finish them. Please let me know if you'd prefer for me to wait until I'm done with everything before submitting.

@@ -75,6 +75,8 @@ class AppExport DynamicProperty
//@{
/// Get all properties of the class (including parent)
void getPropertyList(std::vector<Property*> &List) const;
/// get all properties with their names
void getPropertyNamedList(std::vector<std::pair<const char*,Property*> > &List) const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the getPropertyMap contain all this same information?

Why is it necessary to have this info in a std::vector<std::pair> rather than the std::map that is already provided?

For example, I see this is used in ExpressionParser.cpp but couldn't that range-based for-loop loop over the key-value pairs in the std::map that is already provided?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Commit bdc1c835 introduced this API and mentioned the usage in its commit message. It is for property aliases. Originally PropertySheet just add a real duplicated property with a different name as alias, which is a waste of resources.

@@ -71,7 +71,10 @@ struct AppExport Expression::Component {
class AppExport UnitExpression : public Expression {
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
UnitExpression(const App::DocumentObject *_owner = 0, const Base::Quantity & _quantity = Base::Quantity(), const std::string & _unitStr = std::string());

static UnitExpression *create(const App::DocumentObject *_owner, const char *unit);
Copy link
Contributor

Choose a reason for hiding this comment

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

This static method seems unnecessary. I can see that it is being used in the parser (yacc), but it is simply a workaround due to a misuse of Flex/Yacc.

There is a very nice overview here, but to summarize, the lexer should parse an arbitrary string into tokens.

In this case, the lexer should determine whether or not a given string is a valid UNIT.

Next, the lexer can assume that any UNIT it recieves is valid, since the lexer took care of the grammar. The job of the lexer is to ensure that the tokens created by the lexer are put together in a valid order.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Commit d1e6fe6 introduced this change and explained the reason behind it. When new units are introduced (which happens quite often), the name may clash with existing property names or aliases. It is possible to disambiguate the meaning of the token under the usage context. However, the lexer has no concept of context, which is why it is not suitable for interpreting unit here.

@@ -101,7 +106,7 @@ class AppExport UnitExpression : public Expression {

private:
Base::Quantity quantity;
std::string unitStr; /**< The unit string from the original parsed string */
const char *unitStr; /**< The unit string from the original parsed string */
Copy link
Contributor

Choose a reason for hiding this comment

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

Why has this type been changed?

I can see that the UnitExpression constructor has been updated such that it takes 2 rather than 3 arguments, with unitstr defaulting to 0 in a protected constructor when needed but...why?

What is the purpose of this change? It seems to obfuscate and make things more difficult than they need to be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The purpose of commit d1e6fe6 is to concentrate all unit string in one place as constant string, for both parsing and printing. Any unknown unit will be interpreted as a VariableExpression. So there is little reason to use std::string here.

@realthunder
Copy link
Collaborator Author

@ezzieyguywuf Please continue. I'll reply your comments later.

@ezzieyguywuf
Copy link
Contributor

@realthunder saw your replies to my comments, thank you for taking the time to read through them. I will find some time to review your replies and provide some responses of my own, as well as to continue the code review (i had stopped earlier to give you a chance to catch up)

@berndhahnebach berndhahnebach added Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD and removed For 0.20 labels Sep 17, 2021
@FreeCAD FreeCAD deleted a comment from freecadci Oct 5, 2021
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@berndhahnebach
Copy link
Contributor

berndhahnebach commented Jul 5, 2022

fixed ... FreeCAD/FreeCAD-CI@a11fb14

and improved .... FreeCAD/FreeCAD-CI@fb0f2a9

@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@FreeCAD FreeCAD deleted a comment from freecadci Jul 5, 2022
@berndhahnebach
Copy link
Contributor

pipeline status for feature branch PR_3062. Pipeline 574892909 was triggered at ad9cf27. All CI branches and pipelines.

@realthunder realthunder mentioned this pull request Jul 13, 2022
7 tasks
@gabrielgrant
Copy link

gabrielgrant commented Sep 13, 2022

this has been pending for quite a while. what's needed to move this forward (other than fixing some merge conflicts that have accumulated during the delay, of course)?

@realthunder
Copy link
Collaborator Author

PR suspended for now, and will resume after topo naming merge.

@luzpaz luzpaz added ✋ On hold This PR must not be merged before some condition is met WB Spreadsheet Related to the Spreadsheet Workbench Expressions labels Nov 8, 2022
@luzpaz luzpaz marked this pull request as draft November 8, 2022 14:15
@adrianinsaval
Copy link
Member

adrianinsaval commented Nov 23, 2022

i know this is on hold but for the record I get an error when compiling:

FAILED: src/Mod/Part/App/CMakeFiles/Part.dir/ShapeUpgrade/UnifySameDomainPyImp.cpp.o 
/usr/bin/ccache /usr/lib/ccache/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFCUseFreeType -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DPart_EXPORTS -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_XML_LIB -D_OCC64 -I/fakepath/src/FreeCAD/build/src/Mod/Part/App/Part_autogen/include -I/fakepath/src/FreeCAD/build -I/fakepath/src/FreeCAD/build/src -I/fakepath/src/FreeCAD/src -I/fakepath/src/FreeCAD/build/src/Mod/Part/App -I/fakepath/src/FreeCAD/src/Mod/Part/App -I/usr/include/opencascade -I/usr/include/python3.10 -I/usr/include/freetype2 -isystem /usr/include/qt -isystem /usr/include/qt/QtCore -isystem /usr/lib/qt/mkspecs/linux-g++ -isystem /usr/include/qt/QtXml -Wall -Wextra -Wno-write-strings -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -fPIC -w -fPIC -fPIC -std=gnu++17 -MD -MT src/Mod/Part/App/CMakeFiles/Part.dir/ShapeUpgrade/UnifySameDomainPyImp.cpp.o -MF src/Mod/Part/App/CMakeFiles/Part.dir/ShapeUpgrade/UnifySameDomainPyImp.cpp.o.d -o src/Mod/Part/App/CMakeFiles/Part.dir/ShapeUpgrade/UnifySameDomainPyImp.cpp.o -c /fakepath/src/FreeCAD/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp
/fakepath/src/FreeCAD/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp: In member function ‘virtual int Part::UnifySameDomainPy::PyInit(PyObject*, PyObject*)’:
/fakepath/src/FreeCAD/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp:64:14: error: ‘unique_ptr’ is not a member of ‘std’
   64 |         std::unique_ptr<ShapeUpgrade_UnifySameDomain> ptr(new ShapeUpgrade_UnifySameDomain(shp,
      |              ^~~~~~~~~~
/fakepath/src/FreeCAD/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp:37:1: note: ‘std::unique_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
   36 | #include "PartPyCXX.h"
  +++ |+#include <memory>
   37 | 
/fakepath/src/FreeCAD/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp:64:53: error: expected primary-expression before ‘>’ token
   64 |         std::unique_ptr<ShapeUpgrade_UnifySameDomain> ptr(new ShapeUpgrade_UnifySameDomain(shp,
      |                                                     ^
/fakepath/src/FreeCAD/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp:64:55: error: ‘ptr’ was not declared in this scope
   64 |         std::unique_ptr<ShapeUpgrade_UnifySameDomain> ptr(new ShapeUpgrade_UnifySameDomain(shp,
      |                                                       ^~~

Adding #include <memory> as suggested fixes it.

@adrianinsaval
Copy link
Member

@realthunder whenever you come back to this please take into account the feature introduced with #7688 and adapt it to use the new syntax to reference constraints that have a name that isn't a valid identifier, if I'm not mistaken it is something like .Constraints[<<name string>>]

@J-Dunn

This comment was marked as off-topic.

@adrianinsaval

This comment was marked as off-topic.

@maxwxyz
Copy link
Collaborator

maxwxyz commented Apr 27, 2024

Could this also be resumed now, after the recent toponaming merges?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Expressions ✋ On hold This PR must not be merged before some condition is met WB Spreadsheet Related to the Spreadsheet Workbench
Projects
None yet