From 571efdc47c8127b468839772ceb6aa9d7075795b Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Wed, 23 Aug 2017 14:33:20 +0200
Subject: [PATCH] fix cast introspection command

---
 alib2cli/src/parser/Parser.cpp               | 2 +-
 alib2common/src/abstraction/CastRegistry.cpp | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/alib2cli/src/parser/Parser.cpp b/alib2cli/src/parser/Parser.cpp
index e8da17a9d9..d9de2ba5d9 100644
--- a/alib2cli/src/parser/Parser.cpp
+++ b/alib2cli/src/parser/Parser.cpp
@@ -244,7 +244,7 @@ std::pair < bool, bool > Parser::introspect_cast_from_to ( ) {
 			from = true;
 		} else if ( check_nonreserved_kw ( "to" ) ) {
 			match_nonreserved_kw ( "to" );
-			from = true;
+			to = true;
 		} else {
 			throw exception::CommonException ( "Mismatched set while expanding param introspect_cast_from_to." );
 		}
diff --git a/alib2common/src/abstraction/CastRegistry.cpp b/alib2common/src/abstraction/CastRegistry.cpp
index cfb14340af..fefc7e86e0 100644
--- a/alib2common/src/abstraction/CastRegistry.cpp
+++ b/alib2common/src/abstraction/CastRegistry.cpp
@@ -73,8 +73,8 @@ std::set < std::string > CastRegistry::listFrom ( const std::string & type ) {
 	std::set < std::string > res;
 
 	for ( const std::pair < const std::pair < std::string, std::string >, std::unique_ptr < Entry > > & entry : getEntries ( ) )
-		if ( sourceTypes.count ( entry.first.first ) )
-			res.insert ( entry.first.second );
+		if ( sourceTypes.count ( entry.first.second ) )
+			res.insert ( entry.first.first );
 
 	return res;
 }
@@ -90,8 +90,8 @@ std::set < std::string > CastRegistry::listTo ( const std::string & type ) {
 	std::set < std::string > res;
 
 	for ( const std::pair < const std::pair < std::string, std::string >, std::unique_ptr < Entry > > & entry : getEntries ( ) )
-		if ( targetTypes.count ( entry.first.second ) )
-			res.insert ( entry.first.first );
+		if ( targetTypes.count ( entry.first.first ) )
+			res.insert ( entry.first.second );
 
 	return res;
 }
-- 
GitLab